Problems with meta tags and special characters
This is an open discussion with 11 replies, filed under General.
Search
What’s the problem with the special characters beeing encoded? Do google and the like have problems parsing them?
I hope google parse then… But I’m afraid it doesn’t parse, so I want to solve this. Does anyone had a similar problem or know how to solve it?
@joaobarbosa - Would you mind posting your XML and XSLT on pastie.org?
I think it isn’t necessary, but here it goes:
http://pastie.org/1004474 (method ‘default’) and http://pastie.org/1004467 (using disable-escaping)
I hope you can help me find a solution. Thanks!
Can you post your XML on pastie.org? That will help us to narrow down what the problem is.
I’ve already posted…
The files I’ve posted are my master.xsl. Do you think you’ll need another page? Because the tags just appear in this file.
Thanks
I just found out that when you use XML
as the output method the value of the content attributes of the meta-tags get encoded. This doesn’t happen when you use HTML
.
Does anybody know about reason of the different behavior?
Thanks @klafterief, your tip solved my problem. :)
I guess this has to do with the fact that you can define your character encoding in said meta
tags:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Of course this doesn’t matter to Symphony as it will send the Content-Type
header and force everything to be Unicode anyways.
But in situations where you can’t modify the headers it makes sense to encode everything as ASCII or ISO-8859-1 before you’ve had the chance to actually tell the browser what characters to expect.
XML on the other hand, has its encoding in the XML-declaration:
<?xml version="1.0" encoding="UTF-8"?>
Everything following that will be Unicode, including the meta
tags, so it’s safe to use those characters there.
You can try and switching back to HTML
and putting the line
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
At the very beginning of your head
section and see if it makes any difference (that’s not a solution, it’s just for the fun of it).
Does anybody know about reason of the different behavior?
Isn’t it part of the XML Specification that everything gets encoded? I’m sure I read that somewhere.
Create an account or sign in to comment.
Hello guys!
I’m having some troubles in my meta tags in a website: special characters are replaced to code. Like this:
Original ( what’s in the file )
Browser ( show source code )
Does anyone knows how to solve this?
Notes: - The page is defined to use UTF-8 as charset. - I’ve already tried to disable the output scaping using this code:
But it didn’t worked.
Thanks a lot!