I have an Arabic ASP.NET MVC4 website with UTF-8 encoding.
I have declared the encoding as UTF-8 in html layout header and have tried to set globalization settings in web.config.
but when I publish in windows azure. some of the text appears in Arabic characters while others appears in weird characters.
In localhost all the text is Arabic.
To give a live example take a look at the front page:
http://alqalam.azurewebsites.net and look at the top left text.
You can also look at http://alqalam.azurewebsites.net/Account/Login
both links show how some characters are displayed in Arabic and others aren't.
Thank you.
can you try adding ?
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
Related
I have asp.net web application using Arabic language ,I published it and host it on Godaddy .
there is no problem when I get Arabic text from database.
But the text in master page like labels it's appear like لوØØ© المعلومات
this problem in master page only , not for all pages ,
I tried to use
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
but the text still appear like لوØØ© المعلومات (only in masterpage)
How can I fix it ?
open the asp page with notepad++
and try save it on other charset (ansi or utf-8)
I have a page in ASP.net (VB) that I'm serving via IIS.
The page is basically a translation of the uk site.
I have:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
at the top of the code, and all the characters show ok in the code.
however in (all) browsers many of the special polish characters, such as 'Ł' are missing, replaced directly with 'L'.
Is this an IIS thing? or could it be something else?
ETA: I just noticed that the polish text portion drawn out of the SQL database is being displayed correctly within the same page..! Odd!
Further edit:
I have found the basic source of the issue, I think, but not a solution:
The areas that are not showing properly are headers and footers, which are imported into the page via Server Side Include.
It seams some sort of encoding is being lost in this import / injection.
Should the imported file have some sort of encoding header?
This sounds like a problem with encoding in your static content files. The content-type <meta> has no bearing on the actual physical encoding of the file. I have a suspicion the file is saved in Codepage 1252 instead of UTF-8.
I suggest you open your *.aspx files (where I assume you're storing the problematic Polish text) in a text editor that supports different encodings (such as VS or Notepad2. Not WordPad or Windows Notepad). Force-save the file with UTF-8 encoding (in VS, go File > Advanced Save Options and ensure "Unicode (UTF-8 with signature)" is selected). Then access your site again.
Also ensure that the Content-Type HTTP header is also correctly set to UTF-8.
First of all take a look at website www.elcieloessalud.com/Tratamientos.aspx
I have built this website for a spanish client of mine, it is built in .net framework 3.5
issue is that i have a cms kind of page that allows me to change text of the pages etc.
when changed, text appears perfect in rich text box but page appears messed up. as you can see in the above page lots of aquÃ,Salvación ,Dios…†etc.. although it should be something like aquí,Salvación,Dios…”
Any help in this help would be appreciated!
Regards,
Umair
Include this on your html header part
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
If you page is not on utf-8, then I suggest to render it on utf-8, or find your charset for your Language and set it. The charset must be the same as your file to have correct render. In the visual studio you can see your char set of your file on the menu: File | Advanced Save Options... In some friends of me this menu is not exist, you can add it on the Tools | Customize. (for more details for how to add it search on internet - there are a lot of info.)
Also you can try to set on web-config (or set your language)
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
Finally i did it :) with help of #Aristos as well!
we need to include
meta http-equiv="Content-Type" content="text/html; charset=utf-8"
in all the pages including masterpage and change charset of language to whatever yours is
and when creating the streamwriter to write we need to indicate the encoding there as well as below
Dim sw As StreamWriter
sw = New StreamWriter(FileName, False, Encoding.UTF8)
and you are done !! :)
happy coding
Is there anyway to have a pound sign display correctly using Lynx text only browser?
using ampersand-pound-semicolon it just shows a u with an accent on top.
using £, nothing displays.
Thanks.
I guess your html is written in some other charset encoding than what the web server is telling the client. The easiest fix is to add
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
to your <head> tag. Another approach is to make the web server send the correct header. For instance:
Content-Type: text/html; charset=utf-8
Note that "utf-8" is just an example. Replace that with your actual encoding.
We have a website that uses Classic ASP.
Part of our release process substitutes values in a file and we found a bug in it where it will write the file out as UTF-8.
This then causes our application to start spitting out garbage. Apostrophes get returned as some encoded characters.
If we then go an remove the BOM that says this file is UTF-8 then the text that was previously rendered as garbage is now displayed correctly.
Is there something that IIS does differently when it encounters UTF-8 a file?
I was searching on the same exact issue yesterday and came across:
http://blog.inspired.no/utf-8-with-asp-71/
Important part from that page, in case it goes away...
ASP CODE:
Response.ContentType = "text/html"
Response.AddHeader "Content-Type", "text/html;charset=UTF-8"
Response.CodePage = 65001
Response.CharSet = "UTF-8"
and the following HTML META tag:
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
We were using the meta tag and asp CharSet property, yet the page still didn't render correctly. After adding the other three lines to the asp file everything just worked.
Hope this helps!
UTF-8 does not use BOMs; it is an annoying misfeature in some Microsoft software that puts them there. You need to find what step of your release process is putting a UTF-8-encoded BOM in your files and fix it — you should stop that even if you are using UTF-8, which really these days is best.
But I doubt it's IIS causing the display problem. More likely the browser is guessing the charset of the final displayed page, and when it sees bytes that look like they're UTF-8 encoded it guesses the whole page is UTF-8. You should be able to stop it doing that by stating a definitive charset by using an HTTP header:
Content-Type: text/html;charset=iso-8859-1
and/or a meta element in the HTML
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
Now (assuming ISO-8859-1 is actually the character set your data are in) it should display OK. However if your file really does have a UTF-8-encoded BOM at the start, you'll now see that as ‘’ in your page, which is what those bytes look like in ISO-8859-1. So you still need to get rid of that misBOM.
If you using access db you should write
Session.CodePage=65001
Set tabtable= Conn.Execute("SELECT * FROM table")