Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need help with character encoding



Hi all,
Sorry for the cross post, but this is both a Java and a Carbon question...

I have a c++ application that has a Java applet front end.  What I need to 
be able to do is scan the disk with the Carbon API to get the Unicode 
names for files and then send that name to the Java application for 
display.

The problem is that the encoding used by the Carbon API is apparently not 
understood by Java.

For example, say I have a file with the Unicode character 0x01DE Latin 
Capital Letter A with Diaeresis and Macron.  In the Unicode standard book, 
this is described as the combination of the letters A with diaeresis 
(0x00C4) and Combining Macron (0x0304).  The Character Palette tool shows 
this as Unicode 01DE and UTF-8 C7 9E.

However, the representation returned by FSGetCatalogInfoBulk shows the 
character as:
the letter "A (0x0041) Combining Diaeresis (0x0308) and Combining Macron 
(0x0304)"

When I send "A (0x0041) Combining Diaeresis (0x0308) and Combining Macron 
(0x0304)" to the Java app, I see the A followed by 2 squares.


So what I think needs to happen is to convert the  "A (0x0041) Combining 
Diaeresis (0x0308) and Combining Macron (0x0304)" to the "A with diaeresis 
(0x00C4) and Combining Macron (0x0304)".  It's my belief this would be a 
conversion from decomposed to composed Unicode.

However, I do not see a way to do this...

The best hope seems to be to use the Text Encoding Converter, but I don't 
see how to set this up.

I'm hoping someone else can share how they've dealt with this issue?




For completeness, on the Java side, we create a String from a byte buffer. 
 Perhaps we need to tell the Java code how the bytes are encoded?  If so, 
what encoding should we use for the data we get from the Carbon API?

As always, any help is appreciated.

Kevin Hoyt

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.