have a site that pulls in data from a MS SQL database and in there the user inputs the price of the property (i.e. £159,950) and on the desktop site this pulls in fine but they have a dedicated mobile site (their choice, going responsive on next re-design) and the pound sign won't pull in, instead it shows the black diamond with a question mark in it. The bizarre thing is though, if I refresh the page the pound sign appears fine so really baffled by it to be honest. When I view the mobile URL in a desktop browser the £ sign shows fine also. Really annoying me now. I have the following in the header:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
and have tried alternatives but to no avail yet. Any ideas? Seems odd that once you refresh it works. You would think it would or it wouldn't. Thank you for any advice.
Check what your server is sending in the HTTP headers. It should be configured to send a charset: header (with the correct value) instead of relying on meta tags in the page code.
NOTE that in this day and age, using any charset other than utf-8 is asking for trouble (makes the site incompatible with any language other than the one for which your specific charset is suited, creates problems with user input when they type anything other than base ASCII characters, prevents using a multitude of useful characters such as emoji, etc.). Consider switching to utf-8 for the entire site.
Try replacing all occurrences of £ with its HTML entity, £.
Ended up using this to fix it by replacing the £ sign with the correct HTML code for it.
<%
sValue = rs.Fields.Item("displayedprice").Value
sValue = replace(sValue, "£","£")
%>
<h3><span class="price"><%=sValue%></span></h3>
Thanks for those that offered help, much appreciated.
Related
I’m writing a website. I do this without the help of any CMS, only naked HTML 5 and CSS 3. I wrote a web feedback form. A person enters their name, and when you click “Send”, the mail client opens, where the name is printed in incomprehensible characters. How can I fix this?
The code in the page header is as follows: <meta charset= "UTF-8">
I tried changing the encoding, but it didn’t help. I configured Apache by default to UTF-8. The result, too, is zero.
I have an unorder list, and � often (but not always!) appears where I have have two spaces between characters. What is causing this, and how do I prevent it?
This specific character � is usually the sign of an invalid (non-UTF-8) character showing up in an output (like a page) that has been declared to be UTF-8. It happens often when
a database connection is not UTF-8 encoded (even if the tables are)
a HTML or script source file is stored in the wrong encoding (e.g. Windows-1252 instead of UTF-8) - make sure it's saved as a UTF-8 file. The setting is often in the "Save as..." dialog.
an online source (like a widget or a RSS feed) is fetched that isn't serving UTF-8
I had the same issue ....
You can fix it by adding the following line in your template !
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
It's a character-set issue. Get a tool that inspects the response headers of the server (like the Firebug extension if you're using Mozilla Firefox) to see what character set the server response is sending with the content. If the server's character-set and the HTML character set of the actual content don't match up, you will see some strange looking characters like those little black diamond squares.
I had the same issue when getting an HTML output from an XSLT. Along with Pradip's solution I was also able to resolve the issue using UTF-32.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-32" />
I created a Mailchimp template for the email newsletter of the company I work for. There's an issue with some links and I can't work out how to fix them.
I add a link into the email like so:
Contact Us
And the link appears fine, but when clicked within Gmail it takes you to the site's 404 page, even though the URL is (on the surface) correct.
After clicking the link, the URL displayed in the address bar is http://www.nameofcompany.com/contact-us.php, which is the correct URL and which when typed into the address bar directly goes to the correct page. But when I visit this URL from the email, then copy and paste it from the address bar into a new email in Gmail, I see: http://www.nameofcompany.com/contact%E2%80%90us.php
So this appears to be an issue with character encoding. I have no idea how to fix it though.
Here's the doctype, charset etc from the HTML of the email.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
The strangest thing is, most URLs in the email work perfectly fine, even those with dashes in.
What's causing this issue and how can I fix it?
Cheers
Okay, fixed it. I found the template on Mailchimp and used "Edit this template's code" to edit the HTML within my browser. Then I found the tag that was causing the trouble, deleted it and typed it back out again. Bit of a crude fix and I'm not sure why the problem originally arose but it's done the job!
E2 80 90 is the Unicode byte sequence for the multibyte hyphen character and you should be using the ASCII one.
Which app. do you use for coding your html files? This has to do with the encoding of the hyphen. Try using a simple text font if you are given such option at your code editor (such as Courier).
I don't know why hyphen was encoded into 3 bytes here - usually non alpha/num characters in URL are encoded into one byte.
Try replacing hyphen with %2D, so that hyphen won't be transformed into %E2%80%90.
I'm trying to use the HTML entity code for 'é' in the title tags of my site, and it doesn't seem to be working in any browser. If I type the French equivalent of "Party:" in the title:
<title>parté</title>
I get parté in the title bar across all browsers when it renders. When I use the 'é' character, it actually works. Does anyone know what is up with this?
Entity references work fine (at least as fine as characters entered directly) in title elements. The problem is most probably caused by something that looks like an entity reference to an author when he looks at his files—the data that browsers get does not include it. Some software is used to generate the HTML document from some file that contains é but the software does not simply pass it forward but e.g. converts & to &.
This can be checked using View Source in a browser.
I tried
<!DOCTYPE html>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>é</title>
<div>é</div>
and it works (FF13)
I used certain characters in website such as • — “ ” ‘ ’ º ©.
I found that when testing to see what my website looked like under different browsers (BrowserLab)
the afore-mentioned characters are replaced with �.
I then changed the charset in the webpage header from:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
to
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Suddenly all the pages have the above mentioned characters replaced with a ?.
Even more puzzling is this is not always consistent across and even within the same page, as some sections display the character • and © correctly.
In particular, I need to replace the character • with one that will display across browsers, can anyone help me with the answer? Thanks.
You should save your HTML source as UTF8.
Alternatively, you can use HTML entities instead.
The source code needs to be saved in the same encoding as you're instructing the browser to parse it in. If you're saving your files in UTF-8, instruct the browser to parse it as UTF-8 by setting an appropriate HTTP header or HTML meta tag (headers preferable, your web server may be setting one without you knowing). Use a decent editor that clearly tells you what encoding you're saving the file as. If it doesn't display correctly, there's a discrepancy between what you're telling your browser the file is encoded in and what it's really encoded in.
Check to see if Apache is setup to send the charset. Look for the directive "AddDefaultCharset" and set it to Off in .htaccess or your config file.
Most/all browsers will take what is sent in the HTTP headers over what is in the document.
If you're using Notepad++, I suggest You to use Edit Plus editor to copy the text (which has the special characters) and paste it in your file. This should work.
Yes I had this problem too in notepad++ copy and pasting wasn't working with some symbols
I think SLaks is right
HTML entities for copyright symbol ©