Hi, My asp.net website is in english (coding etc...). But I want to create a form on my web page that allows users to submit text in another language such as french, russian, hindi etc.... I also want to create text labels in the form in a non-english language
so that the person submitting data to the form in a foreign language can follow the instructions in his local language.
Can the foreign language submitted data be stored in a normal english xml file? If a database table is used to store the foreign text, what datatype to use for the column?
Can you please explain in detail how this can be done!
You need to set the contenttype http header of the page to use a character set that supports the characters for the language of the page. On an ASP.NET page this can be done as follows:
Response.ContentEncoding = Encoding.UTF8;
You can also define the language thru the lang attribute of the webpage's <html> tag. If you need to change it programmatically you can make the <html> tag a server tag as follows:
<html id="html" runat="server">
so you can set it as follows:
html.Attributes["lang"] = "us";
As for storing the data on XML, the XML header also supports an encoding attribute, so as long as it is set to the proper encoding you will be fine. Bellow is a sample header for an XML file that uses UTF-8 encoding:
Member
5 Points
88 Posts
Using non-english text in asp.net website
Apr 23, 2008 10:27 PM|sandyxyz2000|LINK
Hi, My asp.net website is in english (coding etc...). But I want to create a form on my web page that allows users to submit text in another language such as french, russian, hindi etc.... I also want to create text labels in the form in a non-english language so that the person submitting data to the form in a foreign language can follow the instructions in his local language.
Can the foreign language submitted data be stored in a normal english xml file? If a database table is used to store the foreign text, what datatype to use for the column?
Can you please explain in detail how this can be done!
Regards, Sandy
Member
20 Points
6 Posts
Re: Using non-english text in asp.net website
Apr 24, 2008 12:44 AM|fernan|LINK
You need to set the contenttype http header of the page to use a character set that supports the characters for the language of the page. On an ASP.NET page this can be done as follows:
Response.ContentEncoding = Encoding.UTF8;
You can also define the language thru the lang attribute of the webpage's <html> tag. If you need to change it programmatically you can make the <html> tag a server tag as follows:
so you can set it as follows:As for storing the data on XML, the XML header also supports an encoding attribute, so as long as it is set to the proper encoding you will be fine. Bellow is a sample header for an XML file that uses UTF-8 encoding:
<?xml version="1.0" encoding="utf-8"?>