• 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: what encoding does sprintf() expect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what encoding does sprintf() expect?


  • Subject: Re: what encoding does sprintf() expect?
  • From: Ken Turkowski <email@hidden>
  • Date: Mon, 12 Dec 2005 00:14:50 -0800

I'm pretty sure that sprintf will work with any character encoding that is an extension of ASCII. This includes MacRoman, Latin-1 aka ISO-8859-1, Windows aka ANSI, and UTF-8. Beware of trying to limit the field size, when the field contains multi-byte UTF-8 characters, e.g.
sprintf(buf, "%.4s" uniStr);
This may not print out any characters, because there are some 6-byte UTF-8 characters, and sprintf assumes that 1 byte = 1 character. If you don't try to limit the precision of a string, sprintf should work just fine.

-Ken Turkowski

On Dec 9, 2005, at 11:30 AM, "Sean McBride" <email@hidden> wrote:

Also, what encoding does sprintf() expect?

--
Ken Turkowski email@hidden
Reality Pixels http://www.realitypixels.com
Computer Graphics 2D 3D Immersive Imagery
Photo-mosaicing Panoramas Computer Vision
Applied Mathematics Numerical Analysis Optimization

_______________________________________________
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
  • Follow-Ups:
    • Re: what encoding does sprintf() expect?
      • From: Alastair Houghton <email@hidden>
  • Prev by Date: Re: Can I Send Apple Events in Cocoa?
  • Next by Date: call an action of another class
  • Previous by thread: Re: Forcing undoManager to start a new group?
  • Next by thread: Re: what encoding does sprintf() expect?
  • Index(es):
    • Date
    • Thread