Unicode character not showing properly - asp-classic

I am working on a classic asp application hosted in IIS 6. In one asp page user enters some data and this data is e-mailed using Jmail utility.
When the user enters Swedish characters like äöü the mail does not display these characters properly. I found that setting charset in the tag will help. But it is causing me more confusions. The website is hosted on two machines and application is behaving quite differently in both the machines.
Machine 1:
If I set Charset to UTF-8 unicode characters are displayed as two characters. Browser is sending data in UTF encoding but server is decoding in ASCII.
If I set the charset to ISO-8859-1 unicode characters are displayed properly.
Machine 2:
If I set Charset to UTF-8 unicode characters are displayed properly.
If I set Charset to ISO-8859-1 unicode characters are not displayed at all.
Question:
How can I make the same code work in both places?

try to set the encoding in the 2 machine to UTF-8.
how to set encoding in iis.
copy all the files from the machine 2(That work only with UTF-8) to machine 1.
and then try.

Related

Who is setting the content-type response header for an ASP.NET application?

I have an ASP.NET WebForms application which displays chinese characters. The characters are not html encoded. The content-type of the html file is set to iso-8859-1 encoding but the content-type response header is set to utf-8 as you can see in the following screenshots:
I'm trying to find out who is setting the response header to utf-8. I couldn't find it in the code and it is also not configured in IIS.
Does anyone know how we can set it in code or if utf-8 is the default? If it was the default, why would it be not overriden by iso-8859-1 then?
I'm clueless at the moment.
Thank you in advance!

Migrate .net 1.1 aspx page into .net4.5 with Japanese characters

I am working on a project to convert the current web application built using .Net 1.1 that is being migrated to .Net 4.5 using VS2013.
Most of the existing .aspx files (developed in .Net 1.1) have Japanese characters which are not displaying in the browser properly. When I open the .aspx page in EditPlus it shows the proper Japanese characters. Japanese characters in .cs files appear properly.
I have already changed the Unicode to UTF-8.
When I add a new file to the project and copy the content from the old .aspx file then the Japanese characters appear properly.
What am I missing here that would cause the characters to not appear properly in the browser?
Is the browser receiving UTF-8? (In Firefox open view page info)
Check that the globalization tag of your Web.Config is set to UTF-8.
https://msdn.microsoft.com/en-us/library/ydkak5b9%28v=vs.71%29.aspx

Can I get iis7 to ignore the utf8 bom?

Any UTF8 BOM on an included file is forwarded to the browser and ruins layout (which means any editing with notepad is impossible).
Can I learn IIS7 not to forward the BOM?

Inconsistent display of unicode characters on web pages

I have a C program that outputs some data including unicode non-English characters. It works fine in a Windows 7 command window, a Linux telnet session but used to fill a Label field on a ASP/html page it doesn't work in all situations - the platform that the web server is running on seems to affect the output.
Where I have a machine running Windows XP SP3 the program works fine in a command window but in the web page the characters are wrong. e.g. Ø is displayed as Ï.
The web page works fine where the web server is on Windows 7 and Server 2003 SP2. Web browser choice makes no difference.
The problem is probably one of character encoding.
The character encoding can be specified in each page or by setting a default value in the web server.
The Windows XP IIS probably has ISO-8859-1 as the default character set.
you can either change it by configuring IIS or by specifying the character set in each HTML page.
When Ø (U+00D8) is displayed as Ï (U+00CF), the probable explanation is that the HTML page is ISO-8859-1 or Windows-1252 encoded but the browser is interpreting it as CP 850 encoded. Check this using View → Encoding in your browser (it will show you the current encoding being applied to interpret the page, and you can change that to Windows-1252, which exists under some name (like “Western European (Windows)”) there. – There are some other encodings in which the byte 0xD8 is interpreted as Ï.
If this turns out to be the right explanation, and even if not, check the actual and declared character encoding of the page and make sure that they match. See the W3C page
Character encodings.

UTF-8 server encoding results in � characters on an ASP.NET site

I am running an ASP.NET WebForms blog engine web site at maxpavlov.com
I am writing mostly in Russian on my blog. Sometimes, even though I am writing a perfectly normal Russian characters in, when I view the resulting rendered blog post page, I get some symbols substituted with �� characters.
I started digging. First, I have checked to see if a UTF-8 is set as a response encoding in the globalization section in web.config. It always was. Then I have noticed, that the pages my site generate don't have a <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> attibute provided in the page header. So I have added it to both masterpages (the display one, and the admin one - it is blogengine.net's specific stuff).
Now all pages that the web server generates have the charset value set to UTF-8, but the problem remains.
The site, when I create a blog post saves it to XML file, that also has an encoding set at the top of the XML file to UTF-8 with the following line:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
Still, problem characters appear in the browsers, when I go to my site.
Where else should I fix this encoding problem?
More info: Fiddler tells me that the response header Content-Type: text/html; charset=utf-8
What is interesting, is that in different browsers, different characters in the HTTP Response get substituted with a �.
By the way, if anyone still wonders what the thing is - it's IIS Native RewriteModule. It's buggy even in version 2, if you disable it for the site, the problem goes away. Tried to report it in IIS.net - didn't believe me. Just learned to live without it on web sites that need to display a cyrillic characters.
Try using Windows-1251 (cyrillic) encoding for the russian alphabet.

Resources