• 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
wcin, wstring, and encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wcin, wstring, and encoding


  • Subject: wcin, wstring, and encoding
  • From: Todd Heberlein <email@hidden>
  • Date: Sun, 09 Jan 2011 14:35:08 -0800

I have some code that basically looks like this:

wstring filename;
getline(wcin, filename);

When running this from the Terminal application it looks like the characters encoded in filename are encoded in UTF-8 even though wchar_t is 4-bytes wide. For example, if I use the Character Viewer to enter ARABIC LETTER FARSI YEH (Unicode: 06CC, UTF8: D8 8C)

filename[0] = 0xD8
filename[1] = 0x8C

instead of being encoded as a single character

filename[0] = 0x06CC

In other words, the single unicode point is encoded as two wchar_t characters in the wstring filename.

Is there any rule (or even rule of thumb) that lets me know the character encoding of a wstring? And in particular, a wstring read in from a wistream?

Thanks,

Todd

 _______________________________________________
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: wcin, wstring, and encoding
      • From: Andreas Grosam <email@hidden>
  • Prev by Date: Re: Why isn't Interface Builder showing any classes from my project?
  • Next by Date: Re: Why isn't Interface Builder showing any classes from my project?
  • Previous by thread: New project with XCode 3.2.4
  • Next by thread: Re: wcin, wstring, and encoding
  • Index(es):
    • Date
    • Thread