How to encode an extended ASCII in .NET?
-
Hi All, I have an application with sends request to a C++ CGI. The response stream comes with a delimiter ( ASC (143) ). I used ASCIIEncoding which returns the data correctly buy wrongly decoded delimiter (I got "?" instead of ASC 143). I tried UTF7Encoding which returned the delimiter correctly but some data are lost. Does any one has solution for this? I cannot cannot change the CGI layer as its servers as router of more of our legacy applications and my Team Leaders feels that CGI is in perfect shape. Earlier answers would be appreciated. Thanks in ASAP.
Venkatesh Mookkan
My: Website | Yahoo Group | Blog Spot
-
Hi All, I have an application with sends request to a C++ CGI. The response stream comes with a delimiter ( ASC (143) ). I used ASCIIEncoding which returns the data correctly buy wrongly decoded delimiter (I got "?" instead of ASC 143). I tried UTF7Encoding which returned the delimiter correctly but some data are lost. Does any one has solution for this? I cannot cannot change the CGI layer as its servers as router of more of our legacy applications and my Team Leaders feels that CGI is in perfect shape. Earlier answers would be appreciated. Thanks in ASAP.
Venkatesh Mookkan
My: Website | Yahoo Group | Blog Spot
You have an encoding problem, which you should try and solve using the
Encoding
class. There is no such thing as an extended ASCII encoding, or almost everything is an extended ASCII encoding, i.e. most encodings use more than 128 characters and keep the first 128 compatible with ASCII for obvious reasons. Try usingEncoding encoding=new Encoding(codepage);
where codepage is an appropriate integer value. In Western-Europe 1252 would be the first one to try. I can't tell for your region though. Once you have the right Encoding object, either use some of its methods to perform a conversion, or better yet, pass it as an extra parameter to your file operations, e.g.File.ReadAllText(String, Encoding)
:)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
You have an encoding problem, which you should try and solve using the
Encoding
class. There is no such thing as an extended ASCII encoding, or almost everything is an extended ASCII encoding, i.e. most encodings use more than 128 characters and keep the first 128 compatible with ASCII for obvious reasons. Try usingEncoding encoding=new Encoding(codepage);
where codepage is an appropriate integer value. In Western-Europe 1252 would be the first one to try. I can't tell for your region though. Once you have the right Encoding object, either use some of its methods to perform a conversion, or better yet, pass it as an extra parameter to your file operations, e.g.File.ReadAllText(String, Encoding)
:)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Thanks for your time. I got the answers from MSDN Forums[^]
Venkatesh Mookkan
My: Website | Yahoo Group | Blog Spot