[thelist] Re: A Question about encoding in .net

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Fri Sep 23 00:34:15 CDT 2005


After some more investigation: here is -as far as my observations are
concerned- what happens:

Command object : gets bytes from the page using CP1252-encoding
but converts it to a CP1254-encoded String.

OTOH

DataReader : gets bytes from the DB using CP1254-encoding but converts it to
a CP1252-encoded String.

so when I interfere in and do

ResponseString(encoded in CP1254) -> getBytes using 1254 encoding
-> convert to a CP1252-encoded String ->

then feed the string to the CommandObject, the object works as
expected because it converts the string back to the original byte
array (which is 1254-encoded) and then creates a 1254-encoded SQL
INSERT String to the database as per the command line.

The same argument goes for the DataReader as well:

When I interfere and split what the reader returns down to bytes using
1252 encoding, since I know that they are actually bytes of a
1254-encoded String, I can properly construct the String back using
byteArray->toString(1254 encoding)

I cannot find any other reasonalbe explanation other than this to why
things happen the way they happen?

Really strange,

Have you ever coincideded something similar?

Cheers,
Volkan


More information about the thelist mailing list