Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: new nonempty files have wrong encoding information
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new nonempty files have wrong encoding information



Well, I have tried using both Western Roman (system default) and UTF-8 as the default text editing encoding in Preference. When I create a new objective C class file pair, the internal editor shows that they start with ˛ˇ. Syntax coloring does not work and build fails, with gcc, reporting

error: stray '\376' in program
error: stray '\377' in program
error: parse error before '/' token

and lots of

warning: null character(s) ignored

Turning on Show Control Characters reveals that each charaters is in fact two characters, i.e. two byte characters. Syntax coloring works again only if I Reinterpret the file as UTF-16, but of course gcc does not until I subsequently Convert it to any single byte encoding. If it were any single byte encoding it wouldn't have broken gcc.

I can get by by reinterpreting and converting every files created from template but wonder if there is a better solution as this problem seems rather trivial. Thanks!


From: David Ewing <email@hidden>
To: John Karp <email@hidden>
CC: email@hidden
Subject: Re: new nonempty files have wrong encoding information
Date: Fri, 12 Mar 2004 10:57:22 -0700


On Mar 11, 2004, at 7:10 PM, John Karp wrote:

When I create a new cocoa bjective c file in a project, it is always in UTF-16 encoding regardless which encoding I have choosen in Preference for Text Editing. So I have to "Reinterpret" the skeleton file as UTF-16. Since gcc only understands 8 bit code, I then have to convert it to UTF-8 or other encoding compatiable with 8-bit code. I haven't tried other cases, but I am guessing that that this is due to the template files themselves being in UTF-16 encoding and somehow my preference setting is not being respected by the new file menu command. What is the fix for this annonyance? Please point me to earlier post if it has been addressed (I searced but did not find anything.)

This is a known issue. But I don't think the files start out as UTF-16. They should start out with an 8-bit encoding. I don't recall which one, but it should be compatible with gcc. Reinterpreting the encoding as UTF-8 should be safe. What is your default encoding set to in your preferences?


Dave


_________________________________________________________________
Get business advice and resources to improve your work life, from bCentral. http://special.msn.com/bcentral/loudclear.armx
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.





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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.