New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

mbtowc and extended/high ASCII

Post Reply New Thread Subscribe

Thread Tools

Member Since: Jun 05, 2009
Posts: 2
sfinster is on a distinguished road

sfinster is offline
I have a suite of programs that run on Windows and linux (redhat, fedora). My current task is to get them running on a mac running OS X.

Internally the programs use wide characters/UTF-8. We need to be backwards compatible with a version of software that stored things in extended ascii (which I gather is also called high ascii).

On fedora when I call mbtowc with a value between 128 and 255, I get the appropriate wide character. On the mac it fails. I *think* I found in sources that in Darwin, mbtowc considers only 0 to 127 to be valid ascii characters. Does anyone know for sure that this is true?

Is there a different conversion I can use, or am I going to have to write my own mbtowc?


QUOTE Thanks

Member Since: Jun 05, 2009
Posts: 2
sfinster is on a distinguished road

sfinster is offline
I will answer myself in case someone else ever needs to figure this out.

On redhat and fedora systems, we're stripping the UTF-8 off our LC_TYPE if we detect that we need to do extended ascii. (For example, en_US.UTF-8 becomes en_US) On those systems our version(s) of libc can handle it.

On our ancient solaris systems we have to set our locale to "C" and hope for the best. This is apparently what the mac needs. At least, it works well enough that I can move on to the next hurdle.
QUOTE Thanks

Post Reply New Thread Subscribe

« Loading EZ-USB firmware | X fails to build on Darwin »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 07:51 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?