Hi all.
I have a database with a lot of accented characters like below
http://i49.tinypic.com/r89wgo.png
Using mysql_fetch_assoc() and mysql_query(), I cannot get my file to contain
ả
Any help would be appreciated
Hi all.
I have a database with a lot of accented characters like below
http://i49.tinypic.com/r89wgo.png
Using mysql_fetch_assoc() and mysql_query(), I cannot get my file to contain
ả
Any help would be appreciated
You're trying to get it to display the html entity for the special character, and not the special character, or the other way around?
One of these two functions should help you out
http://phpbuilder.com/manual/en/function.html-entity-decode.php
I'm trying to have my output show the entity. I'm trying to write a script that would export rows so that they can be imported elsewhere.
When I go to import my data, the text ends up looking like the original data.
Ok, that's what it sounded like. Take a look at the first link I put up and this example is how it works:
$html = ".ả";
echo "Before:<br/>";
echo $html;
echo "<br/>";
echo "After:<br/>";
echo htmlentities($html);
Here is the output form that:
Before:
ả
After:
..ả
Last Edit:
Added a period infront of .ả so it won't get converted when it's not supposed to, so I can actually show what I'm trying to show.,,
personally I would set everything to utf8 (page\db\db connection), then you don't need to encode\decode use HTML entities, just remember to use the php multi-byte functions as the native support for multi-byte characters is poor.
I tried htmlentities() before only to find that it converts a lot more than needed (the letter a with the accent)
I never used multibyte string functions before so I don't know where to start
Edit:
I've attached my import and export scripts along with the xml file that I'm trying to re-import.
Hopefully this helps
[Off topic]
I cannot edit my post? o_O
[/Off topic]
I think I got this figured out
I wrote the following function that would turn all & to &
function jU_encode($string) {
return utf8_encode(str_replace("&", "&", $string));
}
As a result, I got my desired result
I'm still trying to understand as to why it worked out
Thanks for your input