tags:

views:

56

answers:

2

my script is using utf8_general_ci and im trying to transfer to another script that also uses utf8_general_ci the problem is my script store everything as is, like "áéíóú" and the new script as "áéà óú", so im having characters problems like "ru��es" how can i convert that?

A: 

If your scripts are in different files, make sure that your file encoding is similar.

ignas
the problem is not "script side", i mean that because i dont want to change the script because he already got his own data and its also the same utf8, the problem is only the way my old script used to store data, because he didnt converted any chars so i have then in database as "áéíóú" instead of the converted ones...just want to know how can i export the old database converted to "áéà óú"
Pizza Overflow
+2  A: 

When you pull the data out of file #1 make sure to run something like

$data = utf8_encode($data);

This will make sure that PHP understands that it is reading, and should maintain, a UTF8 encoding. After that you should be able to re-write to a file, database, etc without problem. Doing this has solved the issue for me when working with language translations where I know the source is UTF8 but PHP wants to make it something else during the transition.

If that doesn't fix it try running that same function on the body before you send it to the browser.

angryCodeMonkey
i made it work using: $data = file_get_contents("old_db.sql");$data = utf8_encode($data); but i dont think its the right type of convertion...i dont know what kind of chars are those "áéà óú" but when i run your script they become something similar but its not working, i get a "ficações" at the script output...but your idea is working, just need to know what is the right conversion type now
Pizza Overflow
found! $data = sqlite_udf_decode_binary($data);
Pizza Overflow