PDA

View Full Version : Tracking Down an Encoding Bug (HTML/PHP)


Ryan
2008-02-24, 20:20
I'm putting together a community website using Joomla but I've run into a snag with the eWeather extension. It seems to be a simple encoding problem, but I have no idea how to fix it! :o

Instead of a ˚, I get the regular "missing symbol" mark. It doesn't work in Firefox or Safari, and the W3's validation service refuses to even check the page because it doesn't recognize the symbol!

http://test.katynews.net/

(Right hand column, the weather module.)

I'm using Joomla 1.5.0 Production/Stable and it's encoded in UTF8. It's hosted by Dreamhost, if that matters.

chris e boy
2008-02-25, 11:41
Try using the HTML code ° instead if you've got any access to the source code.

Ryan
2008-02-25, 13:14
Try using the HTML code ° instead if you've got any access to the source code.That's what I want to do, and I have access to the source, but I can't figure out where that line is buried! The developer's site is in German so it's very little help.

I was hoping maybe someone at AN might have used this extension at some point.

Brad
2008-02-25, 13:20
If no one has an answer for you by this evening, I'll take a look at this myself when I get home tonight. I've become a bit of a resident expert on encoding problems at my job and PHP's handling of text encoding is on my Hate List.

colivigan
2008-02-25, 14:06
If you change the page encoding to ISO-8859-1 (View->Character Encoding in Firefox), it displays correctly. I guess that's not a valid character in UTF-8?

Does your page need to use UTF-8 encoding? I see the following in the source ...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Ryan
2008-02-25, 14:10
If no one has an answer for you by this evening, I'll take a look at this myself when I get home tonight. I've become a bit of a resident expert on encoding problems at my job and PHP's handling of text encoding is on my Hate List.

Thanks!

I'm still hunting through the source code. It doesn't look like the developer simply put a ˚ symbol in his source code but rather assigned it to a variable which gets called when the HTML is written. I haven't been able to find that yet.

Ryan
2008-02-25, 14:23
If you change the page encoding to ISO-8859-1 (View->Character Encoding in Firefox), it displays correctly. I guess that's not a valid character in UTF-8?

Does your page need to use UTF-8 encoding? I see the following in the source ...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />Yeah, I noticed it works with ISO 8859-1, but I thought UTF-8 was the "best" choice? Admittedly, I don't know much about encodings.

That said, I've figured it out. For some reason, the developer used a non-encoded infinity sign where the degree symbol should have been, which is why I didn't see it. I've replaced all of them with &deg; instead and it works now.

Thanks guys!

Brad
2008-02-25, 17:25
Yeah, I noticed it works with ISO 8859-1, but I thought UTF-8 was the "best" choice? Admittedly, I don't know much about encodings.

For starters:

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) (http://www.joelonsoftware.com/articles/Unicode.html)

:p

Ryan
2008-02-25, 18:44
For starters:

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) (http://www.joelonsoftware.com/articles/Unicode.html)

:pSo, UTF-8 is correct?

:p