# [PATCH] patch to make mysql select correct encoding on client libraries.

- Thread: https://externals.io/message/19659
- Original archive: https://news-web.php.net/php.internals/19659
- Started by scuzzy on 2005-10-17T09:24:09+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #19659 — scuzzy — 2005-10-17T09:24:09+00:00

URL: https://externals.io/message/19659#19659

Hi,
I've attached a patch, that will allow people to be able to change the client
default encoding type, as this was not possible before. I looked through the
php mysql client source, and found no traces of something that could actually
set the default client encoding type.
basically mysql_options(&myHadle, MYSQL_SET_CHARSET_NAME, "utf8"); or whatever
charset you choose.
It reads the option from the php.ini file, which I've also patched to include
the line required, but is commented by default:
; mysql.default_character_set = "utf8"

When it's commented, it falls back to the mysql client library default of latin1.
I've read a few forums, and this is apparently a common problem, and I just
thought I'd lend a hand to help you guys out. I'm sure you get inundated with
stuff like this all the time.
Anyway. Take a look at the patch, it's really simple, but it helped us out as
a company quite a lot. (www.complinet.com)
I hope it helps.
Thanks
Daine Mamacos.


--
random signature

---

## #19661 — Andrey Hristov — 2005-10-17T13:00:30+00:00

URL: https://externals.io/message/19659#19661 · In reply to: #19659

Hi,
the patch did not go through :(

Andrey

Quoting scuzzy <scuzzy@reverseorder.net>:

> Hi,
> I've attached a patch, that will allow people to be able to change the client
> default encoding type, as this was not possible before. I looked through the
> php mysql client source, and found no traces of something that could actually
> set the default client encoding type.
> basically mysql_options(&myHadle, MYSQL_SET_CHARSET_NAME, "utf8"); or 
> whatever
> charset you choose.
> It reads the option from the php.ini file, which I've also patched to include
> the line required, but is commented by default:
> ; mysql.default_character_set = "utf8"
>
> When it's commented, it falls back to the mysql client library 
> default of latin1.
> I've read a few forums, and this is apparently a common problem, and I just
> thought I'd lend a hand to help you guys out. I'm sure you get inundated with
> stuff like this all the time.
> Anyway. Take a look at the patch, it's really simple, but it helped us out as
> a company quite a lot. (www.complinet.com)
> I hope it helps.
> Thanks
> Daine Mamacos.
>
>
> --
> random signature
