• 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: Strange behavior of stringWithFormat and accented characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behavior of stringWithFormat and accented characters


  • Subject: Re: Strange behavior of stringWithFormat and accented characters
  • From: John Stiles <email@hidden>
  • Date: Mon, 24 Oct 2005 14:37:54 -0700

The short answer is, "it will sometimes work just by luck."

It depends on multiple factors, such as "which character is it?" and "what is the current system locale?" Even if you can find a string which will always work for you, it will probably stop working if you change the computer's primary language or if you change to a different version of Mac OS X. There is no way to make @"..." to work reliably with non-ASCII, end of story.

(It's kind of like writing to NULL or to a random pointer in Mac OS 9. It wouldn't always crash right away--in fact, sometimes things would silently work for weeks or months before you noticed the problem! But it was never the right thing to do.)


On Oct 24, 2005, at 2:14 PM, Olivier Mergault wrote:


Le 24 oct. 05 à 22:00, glenn andreas a écrit :


You can't have non-ASCII characters inside a @"..." construction.


As I have read in many places…


This is discussed about every two weeks - a quick search of the archives will reveal all the gory details, suggested alternative constructions, and general griping.

The best general solution is to move that constant string to a localized.strings file so that it can be properly localized as well as avoiding the non-ascii characters inside the literal.


I am like St Thomas, I believe what I see. And I see in the debugger two different manners to handle the same code !


As I don't see anyone putting pictures in their mails and I have a web site, I put some snapshots on a page, here :

http://www.cscinema.com/Cocoas/string_problem.html

It deserve a click !

If the behavior had been consistent, I would'nt have asked — and certainly found the answer on the web.
But, how do you explain what is happening here ?


Olivier
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Strange behavior of stringWithFormat and accented characters (From: Olivier Mergault <email@hidden>)
 >Re: Strange behavior of stringWithFormat and accented characters (From: glenn andreas <email@hidden>)
 >Re: Strange behavior of stringWithFormat and accented characters (From: Olivier Mergault <email@hidden>)

  • Prev by Date: Re: Strange behavior of stringWithFormat and accented characters
  • Next by Date: Re: Finding the relative order of days and months and years [SOLVED]
  • Previous by thread: Re: Strange behavior of stringWithFormat and accented characters
  • Next by thread: Re: Strange behavior of stringWithFormat and accented characters (RESOLVED)
  • Index(es):
    • Date
    • Thread