views:

103

answers:

2

I have some localization problems in my webpage.

There are basically two problems (that I suspect have a different sulution, but they are conseptually linked)

First problem is this:

I have a website that is using a master page. All text from the page is fine, but all text that comes from the master page file, get scrambled norwegian characters. For example Ø shows up as Ø. It seems that all characthers in the extended ASCII table gets scrambled this way. Afterwards, if I open the master page in Notepad the Ø looks normal, but if I remove the Ø and write a new Ø manually, then save the file from Notepad, and then open the website in the browser, it looks fine and the Ø is shown properly. So it seems that Visual Studio saves the characters wrongly in the master file, but correct for the aspx file.

Any clue here?

The second issue is norwegian characters coming from jQuery. All of these characters get's replaced by a questionmark with a black box around it. Here, modifying the js file in Notepad does not help, and it still display scrambled in the browser.

Any input here would be appreciated.

+2  A: 

Try putting this in your web.config:

<system.web>
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>

Also make sure that all your pages are saved as UTF-8 with signature: open each aspx file individually in your project and click File -> Save As -> Save with Encoding....

Also indicate the encoding in the head section of each page:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Darin Dimitrov
Hi Darin, your a lifesaver. The first tips did not do anything as far as I could see. The last one I had already put. The second was the one that helped me. I don't have any Save with Encoding option (in Visual Studio 2007), but I had the Advanced Save Options that I had not noticed before. Her eI could put the encoding. Putting UTF-8 with sugnature for the master page solved the first issue, and putting the same for my jQuery js file fixed my second problem. Thanks a lot for a very quick answer.
Øyvind Bråthen
A: 

File -> Save As -> Save with Encoding... ???

Any other idea instead of this step? it's hard to make that in so many pages websites.

Thanx.

MRamadan