0

I’ve a PostgreSQL database with SQL_ASCII enconding. When I select data from any table the special characters aren’t showed and don’t know the cause. I try changing the enconding in the page where data is showed. Any help on this?

hakre
  • 193,403
  • 52
  • 435
  • 836
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
  • try [utf8_encode](http://php.net/manual/fr/function.utf8-encode.php) [utf8_decode](http://php.net/manual/fr/function.utf8-decode.php) – mgraph Mar 07 '12 at 15:43
  • Possible duplication of http://stackoverflow.com/questions/633762/special-characters-in-php-mysql And http://stackoverflow.com/questions/2175406/input-text-and-special-characters-and-mysql – Milap Mar 07 '12 at 15:43

2 Answers2

2

"SQL_ASCII" encoding actually means there's no encoding imposed on the data.

As a consequence you (or your application) have to remember what's the encoding of the data you pass to the DB and later when you retrieve it you should apply that knowledge to display the data with the correct encoding.

Example: your application is storing Cyrillic (let's say ISO-8859-5) text in a SQL_ASCII "encoded" database. Later on when you retrieve the data you set the encoding of the webpage your apps generates to Western ISO-8859-15. Then the text on your page will look broken.

Milen A. Radev
  • 60,241
  • 22
  • 105
  • 110
1

So, erm, yea. When you told your database to store ASCII, why are you upset over it for storing ascii? If you want unicode, use a unicode encoding. Or transcode special characters into ascii, using something like xml named entities.

Tyler Eaves
  • 12,879
  • 1
  • 32
  • 39
  • You're right I want Unicode but the database isn't mine meaning I'm not the guy behind the database so I can't change anything there and also I'm not the builder for that reason I'm looking for solutions. Could you tell me what "XML named entities" is? – ReynierPM Mar 07 '12 at 15:52