Ask a Question related to Mac Programming, Design and Development.
-
Bob #1
Converting to Unicode?
I am writing a Carbon app that needs to convert to unicode from other
encodings. I get the feeling that there are many messy old ways to do this
and newer ways. Where should I be looking? In TextEncodingConverter.h? Or is
there something better?
There seems to be a mountain of documentation about this subject. If someone
could cut through the fog and tell me where to look, I would appreciate it.
If it is possible I want to convert a string of bytes from from EUC-JP to
UTF-16.
In TextCommon.h I found this define - it looks like what I want:
kTextEncodingEUC_JP = 0x0920,
/* ISO 646, 1-byte katakana, JIS 208, JIS 212*/
Then for UTF-16 there are these??:
kTextEncodingDefaultFormat = 0, /* Formats for Unicode & ISO 10646*/
kUnicode16BitFormat = 0,
Am I on the right track?
Thanks.
Bob Guest
-
Unicode
I need your advise upon the issue we are facing in the Webexceller application. We have an application that supports the local languages (korean... -
PDETextAdd and Unicode
Hi, All! I have a Japanese text in Unicode an I want to use it with PDETextAdd. The thing is that I need to convert it to the font encoding (the... -
To Use Unicode or not?
I am posting this to hopefully help someone else with the same problem(s) and maybe get an answer? I recenlty updated from 4.5 to 6.1 and have... -
Arial Unicode MS
I have a text string using Arial Unicode MS in Word which I want to cut and paste over to Illustrator 10. I have arial unicode ms installed on my PC,... -
PHP and Unicode
Hi, I'm building a website that will use Unicode data. Back-end using PHP and SQL Server. The SQl Server database will store Unicode data... -
Eric Albert #2
Re: Converting to Unicode?
In article <BB6B4298.1E1F5%bob@bob.bob>, Bob <bob@bob.bob> wrote:
Something like this should work:> I am writing a Carbon app that needs to convert to unicode from other
> encodings. I get the feeling that there are many messy old ways to do this
> and newer ways. Where should I be looking? In TextEncodingConverter.h? Or is
> there something better?
>
> There seems to be a mountain of documentation about this subject. If someone
> could cut through the fog and tell me where to look, I would appreciate it.
>
> If it is possible I want to convert a string of bytes from from EUC-JP to
> UTF-16.
CFStringRef str;
str = CFStringCreateWithBytes(kCFAllocatorDefault, myEUCJPBytes,
numBytes, kCFStringEncodingEUC_JP, false);
if (str != NULL) {
// Managed to create the string successfully
CFIndex length = CFStringGetLength(str);
UniChar *chars = (UniChar *) malloc(length * sizeof(UniChar));
CFStringGetCharacters(str, CFRangeMake(0, length), chars);
// We don't need this any more
CFRelease(str);
// Now chars is the UTF-16 data that corresponds to the
// original bytes.
....
}
Hope this helps,
Eric
--
Eric Albert [email]ejalbert@stanford.edu[/email]
[url]http://rescomp.stanford.edu/~ejalbert/[/url]
Eric Albert Guest



Reply With Quote

