473,385 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

utility to convert from ansi to unicode

Hi all,

I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

Thank you
Emanuele

Nov 22 '06 #1
9 13629
emagzz wrote:
>
I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.
short int widechar;
unsigned char ch;

do {
ch = getnext();
widechar = ch;
putwide(widechar);
while (ch);

assuming (sizeof(short) 1) and that strings are '\0' terminated.
No worries about endianess with the above. Depends on the known
range of ANSI chars.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Nov 22 '06 #2
emagzz <eg*****@kinomat.itwrote:
I need to convert many text file from ANSI to UNICODE.
If the files are "clean" ANSI and you want to go to UTF-8 no
conversion is needed.
Some body knows if there is a free utility that can do this from the
command line so as I can use it inside a batch file.
What makes you think that a newsgroup about the C programming
laguage would be a good place to ask this?

<off topic>
See e.g. http://www.gnu.org/software/recode/recode.html
</off topic>
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Nov 22 '06 #3
emagzz wrote:
Hi all,

I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

Thank you
Emanuele
Umm. I think it's a little bit off-topic. 8-|

Laszlo Kis-Adam
Nov 22 '06 #4
"emagzz" <eg*****@kinomat.itwrites:
I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.
What do you mean by ANSI? (That's the name of the US standards body;
there are a plethora of ANSi standards.)

If you mean ASCII, that's a 7-bit code. There are several encodings
of Unicode. And I don't think this is the right newsgroup for your
question anyway; I'm not entirely sure what is. Perhaps
comp.programming?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 22 '06 #5
CBFalconer <cb********@yahoo.comwrites:
emagzz wrote:
>>
I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.

short int widechar;
unsigned char ch;

do {
ch = getnext();
widechar = ch;
putwide(widechar);
while (ch);

assuming (sizeof(short) 1) and that strings are '\0' terminated.
No worries about endianess with the above. Depends on the known
range of ANSI chars.
What the heck is "putwide"? There's no such function in standard C.
In fact, there appears to be no such function at all. A Google search
turned up just one hit, and that appears to be the result of some
blanks being left out of an old index on docs.sun.com.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 22 '06 #6
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.orgwrote:
>I need to convert many text file from ANSI to UNICODE.
>What do you mean by ANSI? (That's the name of the US standards body;
there are a plethora of ANSi standards.)
He probably means the Windows 1252 encoding, commonly known
(apparently) as "ANSI"[*]. It's the same as ISO Latin-1, but with a
random bunch of printable characters instead of the C1 controls. If
it was Latin-1, the conversion to Unicode would be trivial, since the
code points are the same, but it isn't, so it isn't.
[*] I think it stands for "A Non-Standard Incoding".

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 22 '06 #7
Keith Thompson wrote:
CBFalconer <cb********@yahoo.comwrites:
>emagzz wrote:
>>>
I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from
the command line so as I can use it inside a batch file.

short int widechar;
unsigned char ch;

do {
ch = getnext();
widechar = ch;
putwide(widechar);
while (ch);

assuming (sizeof(short) 1) and that strings are '\0' terminated.
No worries about endianess with the above. Depends on the known
range of ANSI chars.

What the heck is "putwide"? There's no such function in standard C.
In fact, there appears to be no such function at all. A Google search
turned up just one hit, and that appears to be the result of some
blanks being left out of an old index on docs.sun.com.
getnext and putwide are shorthand for whatever the OP wants to do
to get the input and dump the output. I thought it was obvious.
Guess not.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

Nov 23 '06 #8
In article <45***************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
....
>getnext and putwide are shorthand for whatever the OP wants to do
to get the input and dump the output. I thought it was obvious.
Guess not.
*Nothing* is obvious to KT. The guy is dumber than three bags of
hammers.

Nov 23 '06 #9
emagzz wrote:
Hi all,

I need to convert many text file from ANSI to UNICODE.
Some body knows if there is a free utility that can do this from the
command line
so as I can use it inside a batch file.
This is off-topic here.

On my Linux system there's a utility called uniconv. *man
unicode* will tell you what it does. You can either ask in a
unicode group if there is one or a Linux/UNIX group. I don't know
if the utility exists for other environments and I have no idea
how it works. I heard about it when I was switching gentoo to UTF-8.

--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
Nov 23 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Manoj | last post by:
Hi All, I am using command line bcp utility of SQL Server to import data from a text file to database. I have some german words in the text file and after import the German characters are lost....
4
by: Julia | last post by:
Hi, I need to convert unicode string to ansi string Thanks in adavance.
2
by: Clay | last post by:
I need to convert a unicode string to an ansi string. This should not be difficult but I simply cannot find a way to do this. Anyone?
8
by: csanjith | last post by:
Hi, i have a situaion where i need to convert the characters entered in an text field to upper case using C. The configuration id utf8 environment in which user can enter any character (single ,...
1
by: recover | last post by:
#include <xxx> int main() { const wchar* pwcHello=L"hello"; char* pcHello; xxxxxx //do something using stl cout<<pcHello<<endl; } =============out===========
22
by: David Mathog | last post by:
One thing that keeps coming up in this forum is that standard C lacks many functions which are required in a workstation or server but not possible in an embedded controller. This results in a...
1
codexparse
by: codexparse | last post by:
I am writing a browser program in C++ Builder 6 that loads a web page using the following code: void __fastcall TForm1::ToolButton1Click(TObject *Sender) { wchar_t buff; ...
4
by: Peter | last post by:
Does anyone know how to convert the following VB6 code to C# code? Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As Any, Source As Any, ByVal bytes As Long) Dim...
3
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a byte that holds a bunch of data of type REG_MULTI_SZ in UNICODE,. I must convert this byte to a REG_MULTI_SZ in ANSI code. How can i do this,...? TIA,... Regards
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.