Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 73881 - [mysql] new default character set
Summary: [mysql] new default character set
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-09 01:53 UTC by Francesco R. (RETIRED)
Modified: 2005-05-23 12:19 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco R. (RETIRED) gentoo-dev 2004-12-09 01:53:12 UTC
Lately MySQL AB goes to use "utf8" as default character set instead of "latin1".

This change probably affect performance, basically because of the increased size (~60% more on my dbs).

So the choice of use it or not should be leaved at the end user. Also as far as I know, gentoo is utf8 friendly at least in the meaning that it's moving to adopt and support it widely.
so:

What about to add a "utf8" to IUSE that remove the actual forced latin1 default?
or
define a variable like LINGUAS of kde

Also if you chose of not support this I definetively suggest to add the following at my.cnf:

[client]
...
character_set   = utf8
default-character-set  = utf8

[mysqld]
...
character-set-server   = utf8
default-character-set  = utf8

substitute utf8 with latin1 if you want.
This because of strange behaviour that the database has when they are not forced. It threat constant string as one character set and the variable fields as another breaking all queryes with a constant in where clause.

best regards 
francesco

Reproducible: Always
Steps to Reproduce:
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2004-12-09 03:55:48 UTC
LINGUAS deals with locales, but not character sets.
Comment 2 Francesco R. (RETIRED) gentoo-dev 2004-12-09 06:57:17 UTC
hints:
1)
To make phpmyadmin work we must run a script located in phpmyadmin directory, with some substitution:

s/ALTER DATABASE `phpmyadmin`/ALTER DATABASE `pmadb`/
s/pma_/PMA_/
scripts/upgrade_tables_mysql_4_1_2+.sql

2)Probably I missing something but I still have problems with php 
but mysql manual came in help:

http://dev.mysql.com/doc/mysql/en/Charset-collation-charset.html

#Illegal mix of collations
SELECT DISTINCT a, CONCAT(b, '  ', b) AS this_fail
FROM tabella

# NOTE that _utf8 that can be _latin1 for you
SELECT DISTINCT a, CONCAT(b, _utf8'  ', b) AS this_not
FROM tabella
Comment 3 Francesco R. (RETIRED) gentoo-dev 2004-12-14 10:31:46 UTC
Hints 2
Thanks to phpmyadmin that show to me ho to do it in a better way

<html><body><pre>
<?php

$sql = "
SELECT CONCAT(astring, '  ') AS I_am_the_problem , astring
FROM tabella
LIMIT 5
";

echo $sql;

$lnk = mysqli_connect("localhost", "user", "password","database_name",3306,"/var/run/mysqld/mysqld.sock");
$rs = mysqli_query($lnk, 'SET NAMES utf8');
$rs = mysqli_query($lnk, 'SET CHARACTER SET utf8');
// not sure that this apply 
$rs = mysqli_query($lnk, 'SET collation_connection = "utf8_general_ci"');

$rs = mysqli_query($lnk, $sql);

while($row = mysqli_fetch_assoc($rs)) {
	print_r($row);
}

?>
</pre></body></html>
Comment 4 Francesco R. (RETIRED) gentoo-dev 2004-12-14 10:49:09 UTC
<rant>
mysqld 4.1.7 & php 5.0.2

*don't* try

mysqli_multi_query($lnk, 'SET NAMES utf8; SET CHARACTER SET utf8; SET collation_connection = "utf8_general_ci";');

or it will loose the connection and probably burn your cpu and hard disks 
</rant>
Comment 5 Francesco R. (RETIRED) gentoo-dev 2005-05-23 12:19:18 UTC
solved for ebuilds now in the tree (using the "utf8" use flag)