Send As SMS
Note: This blog is sorta marketing-related and less frequently updated than other blogs that I author. If you are more of a techy-geek than a marketing wizard then cre8ive hut will be much interesting for you.
Volkan.

9.24.2005

more on encoding

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 and then feed the string to the CommandObject,

the object works as expected because it converts the string back to the original bytearray (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)

Really strange.


Comments: Yorum Gönder

<< Home

This page is powered by Blogger. Isn't yours?