mbtowc and extended/high ASCII

Joined
Jun 5, 2009
Messages
2
Reaction score
1
Points
3
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?

Thanks

Susan
 
OP
S
Joined
Jun 5, 2009
Messages
2
Reaction score
1
Points
3
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.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top