return to I Love My Journal
A Little Closer to Center...
Musings about Life, Linux, and Latter-day Saints.
Pages
About Me
Links


Tags
PERSONAL 520
SPIRITUAL 416
LDS 312
BOOK OF MORMON 237
SCRIPTURES 154
STUDIO-JOURNEY 129
RELIGION 112
LINUX 79
COMPUTERS 65
LIFE 60
GENERAL CONFERENCE 46
GENTOO 39
MISCELLANEOUS 37
MUSIC 37
PROGRAMMING 33
CARS 29
MICROSOFT 23
FAMILY 23
AUDIO 21
I LOVE MY JOURNAL 18
FUN 15
CHILDREN 12
CURRENT EVENTS 10
NATURE'S WAY 10
VIDEO 9
DRM 9
CONEXM 7
BABBLINGS 7
PROVO CITY CENTER TEMPLE 6
FRIENDS 6
HEROD THE FINK 5
GAMES 5
COMPUTER HARDWARE 5
DRUMS 4
HAND OF GOD 3
ADVERSITY 3
KDENLIVE 3
AUDIO HARDWARE 3
GENERAL INSANITY 3
STUDIO 3
THANKS4GIVING 2
CATS 2
MY JOURNAL 1
POETRY 1
FOREVERGREEN 1
EVERYDAY THOUGHTS 1
GOSPEL 1
PARENTING 1
YOUTH CONFERENCE 1
CHURCH NOTES 1
POLITICS 1


RSS Feed

RSS FeedSubscribe!
Thu - Oct 23, 2008 : 06:12 pm
anxious
   rated 1 time
>>next>>
<<previous<<
PHP / PGSQL Character Encoding
I've been writing a snippet of code to take a list of rows from a table in an Oracle database, and have been having problems with a pesky error having to do with PostgreSQL's character encoding and PHP's handling of it.

The error I've been receiving is thus:

Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xae HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding"

So, after a bit of research and asking in the wonderful people in the UPHPU IRC room, I found the answer.

The PHP function, pg_set_client_encoding() enables me to run the SQL and it inserts everything just fine.  Evidently, the Oracle database's character encoding is set to LATIN1.  So the following code set things right:

pg_set_client_encoding($connection_resource,"LATIN1");

And that is that!  Hope that helps someone in need.