I have a SQL statement where a make a conversion with "convert_from(X, 'UTF8')" on a 'bytea'-field in PostgreSQL. I want to make the conversion not in SQL but in PHP. Is there an equivalent function for doing this in PHP?
2 Answers
iconv('UTF-8', $targetCharset, $x)
or
mb_convert_encoding($x, $targetCharset, 'UTF-8')
http://php.net/manual/en/function.iconv.php
http://php.net/mb_convert_encoding
You will have to specify the target character set, which is implied by the database encoding in the Postgres function.
1 Comment
deceze
Well, what is your end goal? What do you want to convert to?