multibyte character set

multibyte character set


I am searching for a method to convert international non english characters in a multibyte character set (MBCS) or double byte character set (DBCS), Japanese or Korean for example, to an equivalent integer code. Can the CHAR and ICHAR functions be used when the character set is not ASCII? Since the usual ASCII integer codes are from 0 to 255, would the integer code for an international character be in the 256+ range? The reverse conversion from integer code to the character will also be needed. If the CHAR and ICHAR intrinsic functions won't work is there another method to get an integer character code? I have found some routines that can convert from a multibyte character to Unicode. Maybe the Unicode would then be converted to and from an integer using CHAR and ICHAR?

Thanks for your help and advice!
Greg Thorwald

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

CHAR/ICHAR won't work on multi-byte characters.

Check the CVF Programmer's Guide for the chapter on National Language Support - there are routines for converting between MBCS and Unicode - once you have the Unicode, you can (I think) get a unique 16-bit number. Or look at the various Win32 API routines.

I'm guessing that Unicode is your best shot at an "equivalent integer".


Retired 12/31/2016


Thanks for pointing me to more information on the multibyte character sets. Knowing more key words helps to find more information. It is also a help to already know that using CHAR/ICHAR isn't going to work. It looks like I have more to learn more about functions like MBConvertMBToUnicode().

Another question is can the Fortran OPEN statement work with a file name or full file path and file name string from a multibyte character set? The CVF manual says "The name can be any pathname allowed by the operating system" where "name" is the usual FILE specifier in the OPEN statement.

We're hoping to get Windows for other languages soon and installed on some test machines, so I can't yet do any testing with these multibyte character sets. Is there a way to use a multibyte character set for regular English ASCII? Maybe the regular ASCII characters could be used from a multibyte character set as a sort of subset? I would then be able to test the MBCS routines with English before moving onto other languages. Can the NLS routines be used with regular English Windows?

Thanks again for your help and advice!
Greg Thorwald

Leave a Comment

Please sign in to add a comment. Not a member? Join today