Tuesday, March 13, 2012

Set pages encoding in code

A user can set the encoding his browser uses (In IE: View > Encoding).
I will show the page in the language the user selected (English or Japanes).
I do not want to create a seperate page for each language.
On the forms is some UserControls, with say menu's which i build in C# code, and I set the text of menu items according to the selected language.
The body of the page will be text extracted from the database in either English or Japanese.
Can one (should one?) set the page encoding in your code? I've seen that on the older asp pages, the developer set it to one value (en-jpn or sth like that...don't have access to the code as i'm typing), even though the page can be displayed in different languages, what l but sometimes a user have to go and manually set the encoding in his browser for the text to display correctly. (note : *Sometimes*)
Any suggestions what course to follow here?
It seems that with Chinese characters, on don't have problems, but Japanese is a bummer on it's ownGoogle for ResponseEncoding in ASP.NET.

BUT, I don't think that's the way it was meant to be/work. Shouldn't you be checking the language settings of the browser instead? (Tools > Options > languages)

0 comments:

Post a Comment