By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,424 Members | 1,375 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,424 IT Pros & Developers. It's quick & easy.

Determining character code page/encoding programmaticlly

P: n/a
LP
I need to figure encoding or code page of a file programmatically. Also I
was asked to figure out what was the original encoding of different records
stored as Unicode in SQL Server table. So, these records can be outputted to
different files with original encodings.

Can it be done?

By the way, character encoding and code page are pretty much the same thing,
correct?

Thank you
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
LP <lp@a.com> wrote:
I need to figure encoding or code page of a file programmatically. Also I
was asked to figure out what was the original encoding of different records
stored as Unicode in SQL Server table. So, these records can be outputted to
different files with original encodings.

Can it be done?
No - for both problems, I'm afraid. Any UTF-8 file could also be a
Windows CP1252 file, for example. You can make a guess, but it's going
to be heuristic and could be wrong.

As for the SQL Server problem, the characters are just in Unicode -
there's no way of telling whether any one particular string was
originally stored as UTF-8, Unicode or anything else.
By the way, character encoding and code page are pretty much the same thing,
correct?


"Code page" is a type of encoding - in other words, each code page is
an encoding, but there are encodings which have no code page, I
believe.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.