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.
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.
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.
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 have a bit of an odd problem here that I cannot figure out. I have two pages: index.html and index2.html. The utf-8 character encoding works fine in index.html but it does not work in index2.html. For example the following paragraph:
Ex-Fleet Foxes drummer Josh Tillman struck out on his own (he was already a singer/songwriter in his own right prior to joining Foxes) and rechristened himself professionally as “Father John Misty.”
The quotes around Father John Misty display perfectly in index.html but appear as diamonds with a question mark on index2.html. Both pages have this meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
I can even copy and paste the exact same source code from index.html into index2.html and it still does not work. Is there something I need to place into a .htaccess file? I already checked the permissions on both .html files are they are identical. I'm at a loss as to what else the problem might be.
If the result shows the Unicode replacement character �, that means whatever is reading the document is trying to interpret it as Unicode (usually UTF-8), but encountered a byte sequence which is not valid in that encoding.
In other words: the browser is trying to do the right thing, the document is not actually UTF-8 encoded. Check the settings in your editor.
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 ©