Page 1 of 1

Poblem with special characters..

Posted: Thu Mar 18, 2004 2:27 pm
by Next_Gate
I have a huge problem here.. im doing a query and everything works fine, but when i need to make an ECHO of any of the field retrieved with the fetch_row it shows something like this:

Code: Select all

ACREDITACI¢N
but i need it to be displayed as ACREDITACIÓN

what should i do?.. this is the first tiemit happens to me.. and can not find the way out

Thanks in advance

Re: Poblem with special characters..

Posted: Thu Mar 18, 2004 2:33 pm
by TheBentinel.com
Next_Gate wrote:

Code: Select all

ACREDITACI¢N
but i need it to be displayed as ACREDITACIÓN
that little cent symbol coming from your database really is a cent symbol. The htmlentities() function translates it into ¢, I believe.

I tried this:

Code: Select all

<?php

echo htmlentities("ACREDITACIÓN");

?>
And the O' was translated correctly into &Oacute;

How did the cent symbol get into your database? Maybe you have a translator on the front end that is messing it up? If you have to work with that data, then you'll need to write your own translation function to convert them. You can use str_replace for that.

Posted: Thu Mar 18, 2004 2:36 pm
by Next_Gate
already tried but nothiing happened..

Posted: Thu Mar 18, 2004 2:47 pm
by TheBentinel.com
Next_Gate wrote:already tried but nothiing happened..
Dang it. I have a bad habit of editing rather than quoting my own posts. Please look a post or two up from here to see my most recent reply.

Sorry!

Posted: Thu Mar 18, 2004 3:06 pm
by Next_Gate
Well thats funny.. cause i use the SQL SERVER DATA ANALYZER and the data is ok..it says correctly ACREDITACION is when i show (echo) the $FETCH['FIELD_NAME'] when i get the ACREDITACI¢N..

And i dont have any kind of function or something that transforms the daat..

Posted: Thu Mar 18, 2004 3:16 pm
by TheBentinel.com
Next_Gate wrote:Well thats funny.. cause i use the SQL SERVER DATA ANALYZER and the data is ok..it says correctly ACREDITACION is when i show (echo) the $FETCH['FIELD_NAME'] when i get the ACREDITACI¢N..
There's something called charsets that determine how numbers get translated into characters. It's along the lines of fonts, but not quite the same. (Obviously, I don't know much about it)

If your data analyzer is using one charset and your browser is using another, they will display the same byte-value differently.

Think about the wing-ding's font. You type "A", but you get an airplane, or a smiley, or whatever.