• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unicode in XCode?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode in XCode?


  • Subject: Re: Unicode in XCode?
  • From: Matthias Juwan <email@hidden>
  • Date: Wed, 29 Sep 2004 22:14:13 +0200

Thanks to all for your replies!

Unfortunately, I can make use of CFString only to feed the Carbon APIs, because it does not exist on Windows platform. I've written my own portable String class which wraps a Unicode character buffer, using string functions from standard C library.

When the Windows version of my product generates let's say a UTF-16 encoded text file (starting with a BOM, of course), the Mac version should be able to read it. Because wchar_t is a long by default, I'd have to allocate extra memory to convert the data on the fly - same applies when writing a file on Mac. Because this is not very efficient, I'd prefer any other solution.

I already tried to rebuild my libs with "-fshort-wchar", which resulted in linker errors, which I could not really comprehend. I suspect I'd have to recompile libstdc++.a as well with this option to be able to use the string functions with a 2-Byte wchar_t? Now the dumb question: How do I recompile the standard C library?

As I am a complete newbie to the Mac/Unix-like development world, it would be great if someone could point me into the right direction.

Thanks,

Matthias


On Sep 29, 2004, at 1:04 AM, Chris Espinosa wrote:

On Sep 28, 2004, at 3:34 PM, Matthias Juwan wrote:

I am trying to port a Windows application to Mac OS X using XCode. I have some difficulties with unicode strings (wchar_t*):

First, note that wchar_t is not Unicode. If you want to use Unicode strings in Mac OS X, you should investigate CoreFoundation's CFString type. You can use wchar_t for structured storage of any long, character-like thing you want, but there's no assurance that what you put in there will map at all to Unicode code points. See ISO 2022

- The debugger does not display unicode strings in the variables view. Is there a hidden option somewhere to enable this??

No, there isn't. The gdb debugger that underlies the Xcode debugger doesn't handle UTF-8 or any other Unicode encoding all that well. Again, if you use Mac OS X native types (e.g. CFString) you may get better results.

- The size of wchar_t seems to be 4 Bytes on Mac platform, but I would expect it to be 2 Bytes. Is there an option somewhere to change it to (unsigned) short??

In your target's Target Inspector, Build tab, find the Other C++ Flag setting and set it to "<x-tad-bigger>-fshort-wchar".

</x-tad-bigger>

Chris _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Unicode in XCode?
      • From: "Sean McBride" <email@hidden>
    • Re: Unicode in XCode?
      • From: Eric Albert <email@hidden>
References: 
 >Unicode in XCode? (From: Matthias Juwan <email@hidden>)
 >Re: Unicode in XCode? (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: Files still dirty after build
  • Next by Date: Re: Files still dirty after build
  • Previous by thread: Re: Unicode in XCode?
  • Next by thread: Re: Unicode in XCode?
  • Index(es):
    • Date
    • Thread