Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / May 2004



Tip: Looking for answers? Try searching our database.

setlocale and C-UTF-8

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin Hoyt - 25 May 2004 15:58 GMT
Hi all,
I've been using setlocale(LC_ALL,"C-UTF-8") for a while now so my C
strings are UTF-8 encoded.  I am almost absolutely positive that this
worked for the BSD-C version of my app.  Now it's failing and I don't
understand why.

While this is NOT documented, I checked errno after the failed call to
setlocale, it was set to 2 ENOENT.  Not sure what that means... but it
got me to looking in /usr/share/locale and decided to try different
locale strings.

I finally figured out that setlocale(LC_ALL,"en_US.UTF-8") does work.
So, now for the big question... what the heck changed???

As I said before, I'm certain that I tested the BSD version before...
that was with CW 8.2 on Mac OS X 10.2.x.  Now I'm using CW 9.2 on
Panther.  So it could be just about anything...

Several questions come to mind:
1.) is the C-UTF-8 locale provided by MetroWerks or Mac OS?
2.) should the C-UTF-8 locale work with Mach-O BSD-C?
3.) one thing that did have to change as I switched to CW 9 & Panther
isto use mwcrt1.0.  I don't see how this could affect this, but could
it?

Any suggestions?
MW Ron - 26 May 2004 20:30 GMT
>Hi all,
>I've been using setlocale(LC_ALL,"C-UTF-8") for a while now so my C
[quoted text clipped - 9 lines]
>I finally figured out that setlocale(LC_ALL,"en_US.UTF-8") does work.
>So, now for the big question... what the heck changed???

Probably 10.3  made a change in locale name.

>As I said before, I'm certain that I tested the BSD version before...
>that was with CW 8.2 on Mac OS X 10.2.x.  Now I'm using CW 9.2 on
>Panther.  So it could be just about anything...
>
>Several questions come to mind:
>1.) is the C-UTF-8 locale provided by MetroWerks or Mac OS?

If you're using BSD C, it's the Mac OS.  MSL C does provide its own
implementation of locale if it's used instead of BSD C.  MSL C
internally supports the unnamed "" locale, "C", and "C-UTF-8".  In
addition, users can make their own locales and provide them to MSL via a
data file.

>2.) should the C-UTF-8 locale work with Mach-O BSD-C?

Don't know

>3.) one thing that did have to change as I switched to CW 9 & Panther
>isto use mwcrt1.0.  I don't see how this could affect this, but could
>it?

No,  that isn't part of it.

Ron

Signature

 Metrowerks, one of the world¹s top 100 companies and influencers
    in the software development industry. - SD Times  May 2004
              http://www.sdtimes.com/2004sdt100.htm
     
                 Metrowerks, maker of CodeWarrior
Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.