Re: [PHP] Special Characters
Re: [PHP] Special Characters
The problem could be in the character set. Do you use the same charset for the db and in the code?
Re: [PHP] Special Characters
Quote:
Originally Posted by
Daevius
Well, I can see the values in the Database using the SQL Server 2000 Enterprise Manager and the Query Analyzer. I have been using the "Chinese_PRC_CI_AS" Database Collation. It is might be due to this reason that I am able to see unicode characters. Unfortunately I cannot get them correctly displayed on my PHP page.
For instance, I can see the Clan Name in the Database as [SIZE="5"]TKBxGIL
Re: [PHP] Special Characters
try different charset in header
<meta http-equiv="Content-Type" content="text/html;" charset="windows-1250" >
for example
Re: [PHP] Special Characters
or put
echo ("CHARACTER USED");
Re: [PHP] Special Characters
You can even retype your charset from db just by using php. Put this code in the php file:
PHP Code:
mssql_query("SET CHARACTER SET desired_charset");
In the Head put this:
PHP Code:
<meta http-equiv="Content-Type" content="text/html; charset=desired_charset">
Where desired_charset is the one you wish to use. It should work.
Re: [PHP] Special Characters
Use the same text the database uses..
Re: [PHP] Special Characters
I have use this..
Quote:
<meta http-equiv="Content-Type" content="text/html; charset=desired_charset">
Even though I have placed this code in the Header, there is no effect. I am still not able to see the Characters correctly:grr:
The previous Character Set was charset=ISO-8859-1. I have changed it to windows-1250, but still there is no effect
Re: [PHP] Special Characters
I mean the text that is displaying on ur page should be the same font as the text displayed in database.. probably "Times New Roman"
CSS:
Code:
font-family: "Times New Roman", Times, serif;
Re: [PHP] Special Characters
PHP Code:
echo htmlentities('Your text here',ENT_COMPAT,'UTF-8');
Reference: http://nz2.php.net/htmlentities
Re: [PHP] Special Characters
Quote:
Originally Posted by
s-p-n
I mean the text that is displaying on ur page should be the same font as the text displayed in database.. probably "Times New Roman"
CSS:
Code:
font-family: "Times New Roman", Times, serif;
That's what I'm trying to say there. Charset in the db must be the same as in the code.
If it's not, there are cases you can solve by query... as I've written before. But it's not so effective.
Re: [PHP] Special Characters
Quote:
Originally Posted by
greenowl
This here would do it. Use htmlentities() on POST/GET/Whatever and it will store the entity in the database. Doing an echo from the database will show the correct character. This is also another great function that can help you defend against SQL injection, however don't rely solely on this function if you ever decide to use it for just that. Another thing that I should mention is that if you use this function, the special character no longer counts as 1 character, but now it's 4 or 5 characters long.
You'll find better examples in regards to this function here:
http://ca.php.net/manual/en/function.htmlentities.php
Re: [PHP] Special Characters
Tried every possible thing. Haven't got any success yet. Any more ideas?
Re: [PHP] Special Characters
htmlentities should work. I tried it on my own PC at home with the exact symbols you used above.
You can change the charset to which ever one you use for your web page.
Reference: http://nz2.php.net/htmlentities
PHP Code:
htmlentities('The text', ENT_COMPAT,'cp1252');
Please read the reference and convert to your web pages charset. If this does not work then you are not doing it properly.
Re: [PHP] Special Characters
I have use this:
echo htmlentities($row["ClanName"],ENT_COMPAT,'cp1251')
The Special characters are not getting displayed :(
Re: [PHP] Special Characters
I was also looking for information regarding this. Any further updates will be helpful.
Thanks.
Re: [PHP] Special Characters
I haven't succeeded in getting it fixed :(
Still looking for help.
Re: [PHP] Special Characters
You can always put it between <pre> tags.