Convert string to WE8MSWIN1252

Asked

Viewed 808 times

1

Starting working with PHP+Oracle, and I’m having trouble encoding the strings in WE8MSWIN1252 format for oracle.

Does anyone have more information?

  • What kind of trouble?

  • I did not find how to find, and the format I found "ISO-8859-1" does not solve

1 answer

1

Except for some minor differences WE8MSWIN1252 is equivalent to ISO-8859-1 in this way if you use UTF-8 on your PHP pages you should look for a function that converts the UTF-8 Strings to WE8MSWIN1252 and the other one that does the opposite. This way you can convert the String type data before persisting on Oracle and also after reading from Oracle.

From the WEB to the database

$utf8 = 'ÁÉÍÓÚÇÃÕ'; // o arquivo HTML / PHP deve estar codificado em UTF-8
$db_iso88591 = utf8_decode($utf8);

From Database to WEB

$db_iso88591 = 'ÁÉÍÓÚÇÃÕ'; // dado veio do database em ISO-8859-1 compativel
$utf8 = utf8_encode($db_iso88591);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.