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

Russian Characters and ASP.Net

P: n/a
(Type your message here)

--------------------------------
From: Ross Noe
I created an XML file using ASP that has Russian characters. Forsome reason ASP.Net doesn't read the Russian charactersproperly. Is .net capable of reading Russian characters from anXML file created with ASP? The application that the users use toupdate the XML file is still written in ASP and not in ASP.Net.Thanks in advance.

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>5hK79qV8jUuruWtcL1GaXQ==</Id>
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Ross Noe via .NET 247" <an*******@dotnet247.com> wrote in message news:e9**************@TK2MSFTNGP14.phx.gbl...
I created an XML file using ASP that has Russian characters. For some
reason ASP.Net doesn't read the Russian characters properly. Is .net
capable of reading Russian characters from an XML file created with ASP?


Almost certainly so, this is probably a difference in encoding between the
ASP application that generated the XML document containing Russian
characters and the encoding used by ASP.NET to read them. Assuming
the ASP and ASP.NET applications are on the same web server, then
they had access to the same code pages, therefore ASP.NET can read
the document once it is reading it using the correct Encoding. You just
need to tell it which one.

The XML document should be created with an XMLDecl that contains
an encoding pseudo-attribute. The correct encoding should be specified
there by the ASP application when it produces the XML file. If you had
previously used a similar ASP application to consume the XML file in the
past, it's possible you may not have noticed the XML file was missing this
necessary encoding declaration because both of your applications had a
tacit agreement as to the encoding going on. The encoding declaration is
important for different platforms to successfully interoperate with each
other.

In ASP.NET, try loading the XML file through a StreamReader and make
sure you create the StreamReader by passing it an Encoding (if you're not
sure which ones to use, start with the obvious Unicode (UTF-16) one and
if that doesn't work then proceed from there to GetEncoding( ) for various
Russian code pages, see the documentation for the System.Text.Encoding
class for more info on getting the encoding associated with a code page).

I suggest StreamReader because you need to take control of precisely what
encoding the XmlTextReader that it'll be wrapped by (if not by you, then by
the Load( ) method of XmlDocument) uses to read it. You don't have this
degree of control if you use one of the short-cut overloads that takes a file
name.
Derek Harmon
Nov 19 '05 #2

P: n/a
Russian characters have always been a problem. I remember the first Russian
characters I encountered - Boris Badenov and Natasha Fatale, on the Ricky
and Bullwinkle cartoons. Boy, they were always causing trouble! Don't forget
Nikita Kruschev, who once pounded his shoe on a table at the U.N. to make a
point. And of course today we have Vladimir Putin, who, while certainly
lacking the outward hostility of his precursors, still manages to throw a
wrench in the works now and then.

Wish I could tell you what to do about them. Hopefully, at least I've
managed to relieve some of your tension.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Ross Noe via .NET 247" <an*******@dotnet247.com> wrote in message
news:e9**************@TK2MSFTNGP14.phx.gbl...
(Type your message here)

--------------------------------
From: Ross Noe
I created an XML file using ASP that has Russian characters. For some reason
ASP.Net doesn't read the Russian characters properly. Is .net capable of
reading Russian characters from an XML file created with ASP? The
application that the users use to update the XML file is still written in
ASP and not in ASP.Net. Thanks in advance.

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>5hK79qV8jUuruWtcL1GaXQ==</Id>
Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.