ASP.NET WebForms page is partially Encoding Gibberish. - asp.net

i have a webform.page, on a master.page.
When I run from VS Development Server, everything looks great... hebrew and stuff :")
When I deploy/upload the files to 'Arvixe.com' shared server.
the page comes half gibberish.
The content of the Master.Page is kept intact.
The content of the Web-form is Gibberish, EXCEPT for text that come from my SQL DATABASE as NVARCHAR.
There are slight differences in the Web.config (other constraints).
tried playing with <globalization> tag.
all pages contain
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Screenshot - only the Title of the Repeater is hardcoded in the content page

Just Typical...
spend 2 hours searching for the solution.
another 15 min to phrase the question.
and find the solution 2 min after that.
the Content Pages where ANSI so i converted them to UTF8 and uploaded.
Everything is great now both locally, and on the server.

Related

WindowsAzure html utf-8 encoding issue

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" />

Missing (replaced) polish characters after serving via IIS

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.

asp.net text messed issue

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

strange characters on web page

I have a graffiti blog and i have a strange problem which is showing strange char page like this:
alt text http://amrelgarhy.com/ScreenShots/error.jpg
This page was showing when I opened my control panel admin page. It's also showing the same when I try to edit one of my previous posts. My problem is that i don't know what's the reason behind it.
I am not sure how to fix this. All my posts are in English and I always use Windows Live Writer to post.
Has anyone faced a problem like this before? Can you advise me on finding the cause of this problem, and any potential solution?
Looks like it might be an encoding mismatch. Are you opening UTF-8 (or some other Unicode)-encoded files in a tool that doesn't understand UTF encodings or vice-versa?
Try placing this in your master page:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Also, check that a virtual directory has been created.
There seems to be a problem with the content MIME-types. The weirdness you are seeing happens because the server offers content as binary (I'm guessing application/octet-stream) even though it should offer them as text/html. Images should be offered as image/<extension>, for example image/png.
You can manually set MIME-type handlers to certain filetypes. If you are using Apache, you could easily to this in a .htaccess file like this:
AddType text/html .html
If your content is something else than HTML the MIME-type is something different. If your web-server doesn't automatically do this you should probably add the handlers yourself.
All MIME-types can be found from here: http://www.iana.org/assignments/media-types/

<Title> tag being split accross multiple lines when genereated from MasterPage

I have created a website in VS 2008 (C#) that is using masterpages.
In the ASPX pages that are based off the masterpage I'm using the # PAGE title directive to set the title of the genereated HTML page.
When I run the page on my development system the title displays correctly i nthe browser. However when I view the source code in the browser the tag is being broken into 3 lines.
<head><title>
My Page Title
</title>
...other meta tags...
</head>
That looks very strage to me. Is there something that I am doing wrong to cause the type of behavior? Will search engines look down on this syntax with the line breaks?
I'm expecting output like this:
<head>
<title>My Page Title</title>
...other meta tags...
</head>
I've never seen that happen before, and I've used MasterPages and Page Titles a few times in the past year.
From an SEO perspective, search engines would ignore the line break in the title and only look at the actual characters between the open and close statements.
This won't make much of a difference. You should be fine either way, and search engines are smart enough to not get confused only a new line or return. Just as long as the HTML isn't malformed, you should be alright.

Resources