Bug #30545 Character set '#33' is not a compiled character set and is not specified in the
Submitted: 21 Aug 2007 20:20 Modified: 7 Sep 2007 16:59
Reporter: Stanislav Izotov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Charsets Severity:S2 (Serious)
Version:5.0.45 OS:Windows (2003 Server)
Assigned to: CPU Architecture:Any

[21 Aug 2007 20:20] Stanislav Izotov
Description:
I'm running a pure UTF-8 server on Windows. Every program is configured so it should use UTF-8.

Though, almost everytime someone loads a page that goes through PHP I get the following message in my error log:

File 'c:\mysql\share\charsets\?.conf' not found (Errcode: 2)
Character set '#33' is not a compiled character set and is not specified in the 'c:\mysql\share\charsets\Index' file

I believe it's a error from PHP. There are a few submissions about this and you have said that it isn't a bug with MySQL or you can't reproduce it.

I strongly believe there is a bug somewhere because I can recreate it with all sorts of installations on various Windows platforms.

I have googled quite a bit and there is a handful of people who get the same error under the same circumstances but no one have found a solution.

How to repeat:
To reproduce I think you need to do this:
* Set MySQL to use UTF-8 for all databases
* Set PHP to only use UTF-8
* Set Apache to only use UTF-8
* Install a forum or something and post with non ascii characters.

I have done this with everything from Apache 4.0.?? and PHP 4.? through the last year and I have never found a solution.

Suggested fix:
I have no idea, the webpages work but the error message expands the error log so it's practically unusable. If you are not willing to run some gawk script to filter the lines out you will have a nasty time with the error log.
[21 Aug 2007 20:30] Sveta Smirnova
Thank you for the report.

But version 5.0.24 is quite old. Please upgrade to current version 5.0.45, try with it and if you can repeat the issue create simple PHP test case we can download and try in our environment. Also provide MySQL configuration file.
[21 Aug 2007 22:21] Stanislav Izotov
I updated to 5.0.45 and it still reproduces.

As a test case just install wordpress and set it to UTF-8 aswell and write some Swedish-letters in the blog (åäö ÅÄÖ). If it wont reproduce I can provide more information to pin down what settings you need to reproduce.
[23 Aug 2007 7:52] Hartmut Holzgraefe
AFAIR problem is the mysql library code that comes bundled with PHP,
only when PHP is compiled against a mysql client library that was
itself compiled with  --with-extra-charsets=all  or if there is a
full mysql client installation on the machine running PHP and the
PHP mysql extension configured with the right pathes to find the
loadable charset files charset support works fine with all charsets.

For unix systems the solution is easy: compile PHP with

  --with-mysql=/mysql/install/path

and everything is set up ok for your system.

For windows compiling stuff yourself is usually not an
option so you need a PHP mysql extension DLL compiled
with the right configuration, not the generic minimalistic
one that you get with the mysql client code bundled with 
PHP (which is so generic and minimalistic for a reason though ...)

I *think* the PHP extensions for windows that we provide on 

  http://dev.mysql.com/downloads/connector/php/

have been build with all this in mind, not being a windows
user myself i can't guarantee (or even test) this though ...
[7 Sep 2007 16:59] Sergei Golubchik
*.conf files were used in MySQL 4.0 and before. Starting from 4.1 we use xml charset files. As your error message mentions .conf files it means you're using old client library. Please upgrade.
[17 Mar 2008 20:50] Edgar Ogando
I had this problem within some pages, I couldn't find an answer that solved the problem, but somehow I did:

Problem:
"File 'c:\mysql\share\charsets\?.conf' not found (Errcode: 2)
Character set '#33' is not a compiled character set and is not specified in the 'c:\mysql\share\charsets\Index' file"

Runnig: 
Windows XP (IIS 5.1)
MySQL Server 4.1 (mysql-essential-4.1.22)
PHP 4.4.7 (CGI/FastCGI) 
MySQL Client API version 3.23.49

In "C:\Program Files\MySQL\MySQL Server 4.1\my.ini" file, I found that the charset directive was repeated twice, at the beginning and at the end, so I just deleted the final lines and the error just disappeared.

REMOVING THIS SOLVED THE

#Set the default character set.
default-character-set=utf8
#Path to the character-sets directory.
character_sets-dir=C:/Program Files/MySQL/MySQL Server 4.1/share/charsets/

It looks like the MySQL Administration tool just appended this even if it was already in the file.

This is a weird "problem" as some people managed to solve by doing other changes or even recompiling binaries and all that...
[11 May 2008 22:35] Jesus Trujillo
After several tests over MySQL 4, I found that this bug only appears when:

1) There's any response in the PHP script BEFORE the MySQL connection. I mean...
THIS FAILS:
echo "hello world!";
$ConnectionId=mysql_connect($ConnectionServer,$ConnectionUser,$ConnectionionPass);
THIS RUNS:
//echo "hello world!";
$ConnectionId=mysql_connect($ConnectionServer,$ConnectionUser,$ConnectionionPass);

AND 2) There's no default-character-set .xml file in /share/charsets/ folder.

So, change your default-character-set to latin1 OR try to avoid using response commands (echo, var_dump, printf, etc.) in your PHP script before any MySQL statement. I chose the first solution because sometimes is not possible the second option.

Hope this will help.