FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Special Characters





Aredon
There's a user on my site with an " " in both his login name and one of his saved characters. The curious thing is, when you look at his profile the special character shows up in his username just fine, but the displayed "main character" has a " � " instead. I've been looking at my code and I can't seem to find anywhere that they were handled differently, but it is still possible. The only reason this is a problem is I need to localize the special character for a game with
Code:
str_replace('','\\195\\160',$string);
and the script fails to recognize it when it's a box. I'm pretty well stumped.... any ideas?
jmraker
The letter may be a unicode letter which would have a string length of more than one letter. And if it's unicode, the page displaying it should be using UTF-8 encoding to display it.

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Aredon
jmraker wrote:
The letter may be a unicode letter which would have a string length of more than one letter. And if it's unicode, the page displaying it should be using UTF-8 encoding to display it.

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

Code:

<!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" />

UTF-8 is already in place, like I said one is displaying just fine.
jmraker
What about the php script, is it saved in UTF-8 format? Some text editors do not handle unicode letters, or save them as ascii instead if the letter is an ascii letter > 127
Agent ME
If you're on Windows, a good text editor that lets you set the file encoding easily is Notepad++.
sonam
Are your data base saved in utf-8 encoding? Maybe this cause a problem.

Sonam
Aredon
I checked all the UTF settings to no avail. What's odd is that if I did a test query such as.. "UPDATE `database` SET `thing`=''" it would show up as a box when later pulled from the database. If you looked at the database with phpmyadmin it looked fine. However, if the character was submitted through a form and the query had a variable instead of the straight string... "UPDATE `database` SET `thing`='".$special_char."'" It went in fine, and pulled from the database fine. I really have no idea why that is.
Related topics
php sessions
I cant install php chat tables nor set up diffrent subdomain
Hardware : You know you want one!
Can anyone (preferrably a Muslim) 'splane this to me?
This C code is little unclear to me.
Need help securing wireless network
Unhide Your Administrator Icon
mysql_real_escape_string question
I could really use some help with Javascript...
phpBB 2.0.20 RELEASED
XML with C++
phpBB 2.0.21 Released
Can You Get HTML in Your PHP Mail Script?
WordPress and special characters
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.