And if you really, really need to access legacy Mac OS 9 text files, the correct encoding to use is CFStringGetSystemEncoding(), which is in CoreFoundation.

GetApplicationTextEncoding(): legacy encoding (if any) corresponding to the language *the app is running in*. As Aki says, it's for resources inside the application itself (hence the name of the API). CFStringGetSystemEncoding(): legacy encoding (if any) corresponding to the user's primary language, which may differ from the language the app is running in (e.g., English-only app on Japanese system). This is the correct encoding to use for legacy Mac OS 9 text files.

Deborah

On Nov 21, 2008, at 12:39 PM, Aki Inoue wrote:

Hi,

Mike's comment is right on.
The sole purpose of GetApplicationTextEncoding() is to provide functional compatibility with OS 9-era localization resources such as STR#. There really shouldn't be any need to make your app rely on the single script approach even for a modern CFString-based Carbon apps.

For Cocoa apps, you shouldn't have to even bother with localization- specific string encodings.

If you have any need to store text data by yourself, UTF-16 is the recommended storage encoding on Mac OS X. If the file format requires to be a superset of ASCII, you can use UTF-8 as Mike described.

Aki

On 2008/11/21, at 7:27, Michael Ash wrote:

On Fri, Nov 21, 2008 at 4:42 AM, spsaxena <[EMAIL PROTECTED]> wrote:
Hi all,
I am working on making my application carbon free. I could not find any replacement for the API "GetApplicationTextEncoding" probably because this API has not been marked as deprecated yet. Because of this API I need to link with the carbon framework which I don't want. Can you please suggest
any non-carbon API as a replacement for this API.

May I suggest simply removing it and *not* replacing it?

Language-specific text encodings are evil. Sometimes you have to deal
with them, of course. But if you do, then you should already know what
encoding you're dealing with and shouldn't need an API to give you an
"application" encoding. For places where you are able to choose the
encoding, UTF-8 is the only reasonable ASCII-compatible encoding to
use.

Mike
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/goldsmit%40apple.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to