Welcome to WebmasterWorld Guest from 54.145.85.22

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)

New User

5+ Year Member

joined:Mar 9, 2010
posts: 5
votes: 0


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)

Senior Member from US 

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

joined:Nov 29, 2005
posts:6964
votes: 385


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

New User

5+ Year Member

joined:Mar 9, 2010
posts:5
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 15, 2003
posts:2408
votes: 5


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

New User

5+ Year Member

joined:Mar 9, 2010
posts: 5
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 15, 2003
posts:2408
votes: 5


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)

New User

5+ Year Member

joined:Mar 9, 2010
posts: 5
votes: 0


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)

Junior Member

5+ Year Member

joined:Aug 28, 2007
posts:114
votes: 0


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)

New User

5+ Year Member

joined:Mar 9, 2010
posts:5
votes: 0


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)

Senior Member from US 

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

joined:Nov 29, 2005
posts:6964
votes: 385


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 15, 2003
posts:2408
votes: 5


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