Convert Char String to utf16 format - C++ Solaris

View: New views
6 Messages — Rating Filter:   Alert me  

Convert Char String to utf16 format - C++ Solaris

by Kambam, Siva (Midwest Success LLC) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Convert Char String to utf16 format - C++ Solaris

Hi ,
I need to convert a char string in to a utf16 format.
I downloaded the API from
http://icu-project.org/apiref/icu4c/ and build it on Solaris

I am using the following function to convert the input char string to unicode format


Chat inputString[10];
Strcpy(inputString,"test);

UnicodeString* unicode = new UnicodeString(inputString).

I think the input string is convert in to unicode format.

Now What I need is convert the unicode in to   utf16 format.

1. ) Is there  a way that I can convert the Char string in to utf16 format in C++ ( gcc )
2. ) Do I need to convert the char string in to unicode and then convert it in to utf16 format ?
3. ) Does the UnicodeString* unicode = new UnicodeString(inputString) get the required utf16 format ?


Thanks in Advance,
Siva .


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Re: Convert Char String to utf16 format - C++ Solaris

by isabelle.moulinier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Convert Char String to utf16 format - C++ Solaris
My understanding is that ICU uses UTF-16 as internal encoding. See http://www.icu-project.org/userguide/strings.html#strings
 


From: icu-support-bounces@... [mailto:icu-support-bounces@...] On Behalf Of Kambam, Siva (Midwest Success LLC)
Sent: Wednesday, May 02, 2007 4:25 PM
To: icu-support@...
Subject: [icu-support] Convert Char String to utf16 format - C++ Solaris

Hi ,
I need to convert a char string in to a utf16 format.
I downloaded the API from
http://icu-project.org/apiref/icu4c/ and build it on Solaris

I am using the following function to convert the input char string to unicode format


Chat inputString[10];
Strcpy(inputString,"test);

UnicodeString* unicode = new UnicodeString(inputString).

I think the input string is convert in to unicode format.

Now What I need is convert the unicode in to   utf16 format.

1. ) Is there  a way that I can convert the Char string in to utf16 format in C++ ( gcc )
2. ) Do I need to convert the char string in to unicode and then convert it in to utf16 format ?
3. ) Does the UnicodeString* unicode = new UnicodeString(inputString) get the required utf16 format ?


Thanks in Advance,
Siva .


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Re: Convert Char String to utf16 format - C++ Solaris

by Kambam, Siva (Midwest Success LLC) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Convert Char String to utf16 format - C++ Solaris
Thanks for the reply.
Also after converting the char string to unicode is there a function to display the unicode to the console  ?


From: icu-support-bounces@... [mailto:icu-support-bounces@...] On Behalf Of isabelle.moulinier@...
Sent: Wednesday, May 02, 2007 5:23 PM
To: icu-support@...
Subject: Re: [icu-support] Convert Char String to utf16 format - C++ Solaris

My understanding is that ICU uses UTF-16 as internal encoding. See http://www.icu-project.org/userguide/strings.html#strings
 


From: icu-support-bounces@... [mailto:icu-support-bounces@...] On Behalf Of Kambam, Siva (Midwest Success LLC)
Sent: Wednesday, May 02, 2007 4:25 PM
To: icu-support@...
Subject: [icu-support] Convert Char String to utf16 format - C++ Solaris

Hi ,
I need to convert a char string in to a utf16 format.
I downloaded the API from
http://icu-project.org/apiref/icu4c/ and build it on Solaris

I am using the following function to convert the input char string to unicode format


Chat inputString[10];
Strcpy(inputString,"test);

UnicodeString* unicode = new UnicodeString(inputString).

I think the input string is convert in to unicode format.

Now What I need is convert the unicode in to   utf16 format.

1. ) Is there  a way that I can convert the Char string in to utf16 format in C++ ( gcc )
2. ) Do I need to convert the char string in to unicode and then convert it in to utf16 format ?
3. ) Does the UnicodeString* unicode = new UnicodeString(inputString) get the required utf16 format ?


Thanks in Advance,
Siva .


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Re: Convert Char String to utf16 format - C++ Solaris

by Bob Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Convert Char String to utf16 format - C++ Solaris
The code snippet you showed will work because of a "feature" recently discussed whereby the constructor of the UnicodeString class will use the default system code page to "widen" the "narrow" string AND because the data you gave in the example is Ansi and the default code page (on most people's systems) will likely "widen" that string correctly to Unicode.
 
However, if you are using a non-Standard encoding for the text (e.g. anything non-Roman/Ansi/Ascii) OR if your default system code page on a user's machine is not the same as the encoding of the data, then this won't work.
 
You need to clearly separate in your mind the conversion from "narrow to wide" (which is happening by virtue of the UnicodeString constructor for narrow strings and which uses the default system code page) and the conversion from some encoding to Unicode (or UTF-16 as you call it).
 
For the data you showed (i.e. "test"), those two conversion are probably the same; but that may not always true depending on the encoding of your data.
 
Bob
 
 
 
----- Original Message -----
Sent: Thursday, May 03, 2007 2:55 AM
Subject: [icu-support] Convert Char String to utf16 format - C++ Solaris

Hi ,
I need to convert a char string in to a utf16 format.
I downloaded the API from
http://icu-project.org/apiref/icu4c/ and build it on Solaris

I am using the following function to convert the input char string to unicode format


Chat inputString[10];
Strcpy(inputString,"test);

UnicodeString* unicode = new UnicodeString(inputString).

I think the input string is convert in to unicode format.

Now What I need is convert the unicode in to   utf16 format.

1. ) Is there  a way that I can convert the Char string in to utf16 format in C++ ( gcc )
2. ) Do I need to convert the char string in to unicode and then convert it in to utf16 format ?
3. ) Does the UnicodeString* unicode = new UnicodeString(inputString) get the required utf16 format ?


Thanks in Advance,
Siva .


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Changing translit files

by Bob Eaton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Convert Char String to utf16 format - C++ Solaris
Are transliterator tables compiled into the ICU DLLs or is it possible to modify them after installation?
 
A colleague needs to modify one of the transliteration tables in data\translit folder *after* ICU has been installed on his machine.
 
He says that changes he's made to the files are not being reflected by calls to the corresponding transliterator...
 
Thanks,
Bob
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Re: Changing translit files

by George Rhoten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you've compiled ICU to use a .dat archive or individual data files, you
can modify ICU's data after installation.  This is done with
--with-data-packaging=archive and --with-data-packaging=files
respectively.  Since you mention DLLs, I presume this is Windows.  You can
use the Cygwin/MSVC configuration to get that configuration for the data
easily.  You can also do this through the standard project files, but it's
a little more difficult because it requires a little more knowledge about
how ICU is built.

The .dat archive can be modified in its installed location with icupkg.

If you compile ICU's data into a DLL or a static library, the files can't
be changed after the installation, unless you rebuild the data and
reinstall a brand new data DLL.

More details on packaging ICU's data can be found at:
http://icu-project.org/userguide/icudata.html

George Rhoten
IBM Globalization Center of Competency/ICU  San José, CA, USA
http://www.icu-project.org/



"Bob Eaton" <pete_dembrowski@...>
Sent by: icu-support-bounces@...
05/11/2007 03:37 AM
Please respond to
ICU support mailing list <icu-support@...>


To
"ICU support mailing list" <icu-support@...>
cc

Subject
[icu-support] Changing translit files






Are transliterator tables compiled into the ICU DLLs or is it possible to
modify them after installation?
 
A colleague needs to modify one of the transliteration tables in
data\translit folder *after* ICU has been installed on his machine.
 
He says that changes he's made to the files are not being reflected by
calls to the corresponding transliterator...
 
Thanks,
Bob



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support