Welcome to WebmasterWorld Guest from 54.198.222.129

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Circle "R"'s are Driving Me Crazy

Circle "R"'s are Driving Me Crazy

     
3:01 am on Mar 16, 2010 (gmt 0)

5+ Year Member



I'm using php/mysql and the circle 'r' character (®) looks like it is supposed to in the DB.... just like a registered trademark symbol. But, when I print it out to an HTML page I get the funny looking question mark character.

Does anyone know how to fix this?
3:07 am on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



Make sure your doc type embraces the character set.
3:10 am on Mar 16, 2010 (gmt 0)

5+ Year Member



I have used htmlentities() and html_entity_decode() to try to fix it but it doesn't seem to be working. I'm using UTF-8 in those functions and I have UTF-8 set on the doc-type, too.
3:15 am on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is your DB table set to UTF-8 as well?
3:18 am on Mar 16, 2010 (gmt 0)

5+ Year Member



The db table is set to utf8_sweedish_ci. There was not just a "utf-8" selection for this. Which one should I choose?
3:23 am on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe the right one is utf8_general_ci

If this doesn't solve your problem, I have no idea what the cause is ;-)
3:34 am on Mar 16, 2010 (gmt 0)

5+ Year Member



Dang. That didn't solve it. How do you handle clients copy/pasting the circle "r" character into web forms?
3:36 am on Mar 16, 2010 (gmt 0)

5+ Year Member



Escape the characters they try to put in.

If registered is that big, can you make it a checkbox, if checked when it's displayed you'll show the ASCII?
3:41 am on Mar 16, 2010 (gmt 0)

5+ Year Member



They want to put it into the middle of a character string, though. How do you handle that?
3:58 am on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



search for the expected character(s), strip it, then put the proper character back in. More work, of course!
5:13 am on Mar 16, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Of course, that's it. Users copy-paste from a wrong character set. Didn't think about that.

Here's a quick regular expression that will take care of that for you:

s/\u00AE/®/

\u00AE is the "circle r"
® is the corresponding HTML entity ( = ® )

I'm not sure if you use PHP/ASP/Perl/whatever, but I'm sure your programming language of choice has some way to implement a RegExp
 

Featured Threads

Hot Threads This Week

Hot Threads This Month