classic asp character encoding - encoding

I'm having a problem with Spanish characters in a classic asp site. A user is able to submit their name/address in a form on an aspx page. The aspx page then does an ajax post to a classic asp page which all it does is stored in our Sql 2008 DB. I can see in the database that the character is not stored correctly. For example the first name looks like Mª where it should be Mª.
When I then read that data and display it in a text box it is still displaying Mª.
things I've tried:
<%# Language=VBScript codepage=65001 %>
<% Response.Charset="UTF-8" %>
encoding file as UTF-8 (using notepad++)
any other ideas? Do I need to go back into the database and fix the characters first or can this be done when I read the characters and display them?

I had same problem when started using utf-8 on ASP, found that session.CodePage makes the difference. In classic ASP pages do always this first ASP declarations to ensure all page uses UTF-8 for data, forms, asp code, data received or sent.
<%#Language=VBScript CodePage = 65001%>
<%
Session.CodePage = 65001
Response.charset ="utf-8"
Session.LCID = 1033 'en-US
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

What you are looking at is UTF-8. It's probably exactly as it should be, and the problem is that the tool you use for the looking is not handling the UTF-8 correctly, either because it cannot, or because it is not configured correctly.

Related

Non breaking space after an href link is being included in the displayed hyperlink

I am having an issue with emails being sent to users from a saved template. In this template there are non-breaking spaces to preserve formatting that is expected, and there is no issue forming the link or sending the email.
However it seems that after going through the mail server when the tags are displayed on their preferred mail service, some users are seeing the hypertext link malformed.
Example,
This is how the raw link looks in the message we send,
Log in to <a href=\"https://website"\>https://website</a> to
And this is how users are reporting they are seeing the link in the message,
https://website to
Instead of,
https://website
I was able to pull the raw message from a test email after sending it to myself and didn't see that there was any issue with the encoding. Has anyone dealt with this before?
I am not sure if it may be better to try and strip out the character and replace it with a regular space? Or if there is another way to handle this?
You could try wrapping the link with a <span> and it might solve the problem... Note that I have replaced the escaped double quote \" with a single quote '
<!DOCTYPE html>
<html>
<body>
<label>Wrapped the link with a span</label>
<div>
Log in to <span><a href='https://website'>https://website</a></span> to
</div>
</body>
</html>

read/replace jboss system properties in a jsp file

I have set system properties in JBoss 6. I have deployed a war file and everything works fine. The next step I'd like to take is to read those system properties replacing variables in the default index.jsp file to show in the users browser. First, I'll admit I may not be going at this correctly but I need certain properties to display based on what instance the user is connecting to. Maybe there's a better way than what I'm thinking. Any help would be totally appreciated.
I was stuck with the idea that the javascript would be client side so I was having difficulty understanding how it would be done. Here's a snippet of my jsp file and how I was able to get it to work.
<html>
<head>
<meta http-equiv="CACHE-CONTROL" content="NO-CACHE">
<%# page import="javax.naming.Context" %>
<%# page import="javax.naming.InitialContext" %>
<%
...
String dbUrl = System.getProperty("jboss.db.connectionString");
...
%>
...

Weebly header links encoding error for arabic site

My arabic website is created using weebly, today when i wanted to edited any page i found the page I am editing is with encoded page title! even after changing the title again to be arabic, nothing is happening and stil the title is encoded!
I checked my code and it is ok! :
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
And this is the website: www.elbosna.com
Is there any solution to this wired problem that appeared only today?
The strings that you send to the function initPublishedFlyoutMenus are encoded incorrectly. Instead of strings like "title":"&#1575;&#1604;.. your code should contain strings like "title":"ال.. without the & escape code.
Some of the titles in the navigation menu are encoded correctly, so check the configuration on your side, what is the difference between correct and incorrect menu items. It may be something with the tools you use to edit the site's configuration

Encoding of the web page

I have used a free template and used it as a master page in the visual web developer.
Each time I close the master page file and reopen it it will ask me for the encoding of the web page. The title is "Choose an encoding", and body is "Visual web developer was unable to determine the encoding of this file. Please choose an encoding from the list box below".
How can I fix this? How can I save the file with UTF-8 encoding from the beginning.
Try putting a tag like this inside the <head> element:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
That's how you identify the encoding to browsers. Not sure about the editor you're using.

Does IE8 ignore Content-Type's charset in header?

I have a very simple PHP file. I had set the charset using PHP's header() function as below...
header('Content-Type: text/html; charset=utf8');
Nothing was overwriting it, as I inspected the headers and it was coming through fine.
I am using a Unicode arrow (→) on my page. It is directly on the page, and not processed by any string manipulation functions.
It worked fine on Firefox and Safari, but in IE8 it came out as a mess (2 weird glyphs).
After some frustration, I added this to my head as well...
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
...and it fixed it.
What is the issue? Does IE8 ignore the charset in the header? Doesn't the http-equiv mean that it should be treated exactly like a normal header?
Your HTTP header contains utf8, but your meta tag contains utf-8. I'm fairly sure the latter is the correct name. Check if putting utf-8 in the HTTP header helps.