INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Is country unicode?

Is country unicode?

(OP)
Is there a way of determining whether a locale uses 1 or 2 byte data (ANSI OR Unicode) for storing strings?

RE: Is country unicode?

The "locale" is usually always country-specific ANSI, such as e.g. GB2312 for China (PRC), BIG5 for China (Taiwan), Shift-JIS for Japan, and so forth.

When you say "storing strings" though, are you talking about the standard saving fromat from Notepad or the handling of strings in software?

"We had to turn off that service to comply with the CDA Bill."
- The Bastard Operator From Hell

RE: Is country unicode?

(OP)
Thanks for the reply MakeItSo.

It is my (incomplete) understanding that some locale ANSI uses 1 byte per character for storing strings (such as UK) while others (such as China (PRC)) use 2 bytes per character (and others more?).

My problems arise from a VB6 program that makes great use of Put/Get which writes strings using the locale ANSI.  This is fine where all countries it is used in have the same single-byte code page, but I need to call a conversion routine if the country uses a multi-byte code page.  I don't want to call the routine unless it is needed because it slows the whole process down, hence the wish to know whether the locale is single- or multiple-byte.

Hoping that makes sense...

RE: Is country unicode?

There are several encoding formats:

MBCS - 1 to 4 bytes per character
DBCS - 2 bytes per character, popular in Japan
Unicode - 2 bytes per character in Windows, 4 in *nix

With Western European languages, you're fairly safe with 1byte per character.  Anywhere else, you have to switch.  Best use a lookup table.  Even within the same language, the codes may vary (eg chinese uses Big5 and GBK).  Have a look at http://msdn.microsoft.com/en-gb/goglobal/bb964654.aspx.

Whether or not you are in a MS environment, MS has done quite a lot in this area so it is worth having a look.  They support everything from Arabic to Devangari to Chinese and Korean.

RE: Is country unicode?

Unicode is supposed to be a super-set of all the old code-pages.
So I would try and change the code that any data that is input gets stored in Unicode, and where ever possible, output in Unicode as well.

Obviously, if you have some integration processes with systems that still use the old code-page approach, you'll have to make accommodations.

Chip H.


 

____________________________________________________________________
www.chipholland.com

RE: Is country unicode?

(OP)
xwb - thanks for that - I think that this will have to be my approach.  A bit of a bother to set up, but once its done its done.

chiph - yes, ideally I would like to use unicode universally, but I need to make changes to data in databases which would then render them incompatable with previous versions of our software, and I'm not being allowed to do that.

Thanks to all for your time and thoughts.  I have a way forward now and will go away and get on with it...

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close