Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
åäö in mysql problem
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
XtAzY
n00b
n00b


Joined: 18 Jan 2005
Posts: 23

PostPosted: Sun May 07, 2006 2:54 am    Post subject: Reply with quote

woot those previous posts work !!

Last edited by XtAzY on Mon May 15, 2006 9:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Sun May 07, 2006 1:04 pm    Post subject: Reply with quote

I've been running MySQL 5 for a long time (currently at 5.0.19), but still had to apply the latin1 fix to my.cnf.

But I see now that PHP 5.1.4 and MySQL 5.0.21 are available - will try out if an upgrade perhaps solves the problem for good.
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Sun May 07, 2006 1:33 pm    Post subject: Reply with quote

kybber wrote:
I've been running MySQL 5 for a long time (currently at 5.0.19), but still had to apply the latin1 fix to my.cnf.

"fix" 8O - now you see *me* confused.

how i understood CHTEKK this line does *actually belong in there* from now on if you like to continue using latin1.
it's just not in there by default because the devs cant know what charset anyone is using?
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Sun May 07, 2006 4:02 pm    Post subject: Reply with quote

Just a little update: all mysql ebuilds that support latin1 and utf8, now have a latin1 USE flag. So you can switch tha charset back at compile-time if you need to. This makes it a little bit easier now. ;)

@SoylentGreen: yup, you are correct, the charset one wants to use should now be always correctly defined in my.cnf, as to avoid any problems. The default my.cnf now does so too, if you install without latin1 USE you will get utf8 set in there, if with latin1 USE, latin1.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Sun May 07, 2006 4:45 pm    Post subject: Reply with quote

CHTEKK wrote:
Just a little update: all mysql ebuilds that support latin1 and utf8, now have a latin1 USE flag. So you can switch the charset back at compile-time if you need to. This makes it a little bit easier now. ;)

hmm.. i wonder what might happen if i use this globally in make.conf, and have unicode in there as well 8O scary thought, eh? :lol:
CHTEKK wrote:

The default my.cnf now does so too

thats a good step. please put some remarks "#" in there as well. dunno about others, but i myself am a lazy doc reader <g> and prefer examples and descriptions in the cfg itself.

and - as usual - keep up your good work! i am still wondering why this thread is *still* going with questions, and new threads are started twice a day also. maybe because we are on page5 already, and people are not in the mood to read all of this. maybe it should be made sticky?
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Sun May 07, 2006 4:52 pm    Post subject: Reply with quote

hmm..
Code:

[ebuild     U ] dev-db/mysql-4.1.19 [4.1.14-r1] USE="berkdb perl ssl -big-tables -cluster -debug -embedded -extraengine -latin1% -minimal -raid -srvdir -static" 0 kB

why does latin1 have a % sign, and is displayed in yellow?
just realizing it (updateing an AMD64 machine right now)

and, why the fsck does it like to get in aspell, i just realize???
Code:

Calculating world dependencies... done!
[ebuild     U ] dev-db/mysql-4.1.19 [4.1.14-r1] USE="berkdb perl ssl -big-tables -cluster -debug -embedded -extraengine -latin1% -minimal -raid -srvdir -static" 0 kB
[ebuild  N    ] app-dicts/aspell-en-0.51.1  168 kB

pardon? just btw, my lang is de, not en, though ;)

btw: i am able to "play" with the amd64, if this is of any help to you. mysql is just installed there, but was never ever used. so to speak: empty database.
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Sun May 07, 2006 5:37 pm    Post subject: Reply with quote

SoylentGreen wrote:
i wonder what might happen if i use this globally in make.conf, and have unicode in there as well 8O scary thought, eh? :lol:


Nothing. :) MySQL is the only package in Portage having the latin1 USE flag or using it in any way, all the others, if they have charset stuff, use the "unicode" one. So having it globally in make.conf wouldn't change anything, as dev-db/mysql is the only package using it, anyway.

SoylentGreen wrote:
why does latin1 have a % sign, and is displayed in yellow?
just realizing it (updateing an AMD64 machine right now)


Portage 2.1 feature: new USE flags are displayed that way, with "new" I mean a USE flag that was not there in previous version of that package. Since your previously installed 4.1.14-r1 when it still didn't have the latin1 USE flag, and now the new 4.1.19 has it, it will be displayed in yellow with the % sign to show you it's a new USE flag.

SoylentGreen wrote:
and, why the fsck does it like to get in aspell, i just realize???


No idea, MySQL for sure does not depend on any aspell stuff. Try the -t option in your emerge to make it show a tree-view so you can see what's pulling aspell in.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Sun May 07, 2006 5:40 pm    Post subject: Reply with quote

CHTEKK wrote:
@SoylentGreen: yup, you are correct, the charset one wants to use should now be always correctly defined in my.cnf, as to avoid any problems. The default my.cnf now does so too, if you install without latin1 USE you will get utf8 set in there, if with latin1 USE, latin1.

That's just it: If I want to use UTF 8, what do I do? I have to use latin1 in my.cnf now, or else phpBB will look like a mess. How can I
switch completely over to UTF 8? Will I have to dump the database, convert and import?

It's ok to use latin1 with phpBB, I guess, since I know the languages that will be involved on that board. But since every PHP app that
uses the database on this host will use latin1 as well, that may not be a Good Thing (tm). And I like things that are good...

If I have completely misunderstood something and am just making a fool of myself, please let me know ;)
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Sun May 07, 2006 6:35 pm    Post subject: Reply with quote

CHTEKK wrote:
SoylentGreen wrote:
i wonder what might happen if i use this globally in make.conf, and have unicode in there as well 8O scary thought, eh? :lol:

Nothing. :) MySQL is the only package in Portage having the latin1 USE flag

currently - right? hmm.. time will show and tell us better, i fear.
Back to top
View user's profile Send private message
SoylentGreen
l33t
l33t


Joined: 19 Aug 2005
Posts: 904
Location: The Hostel

PostPosted: Sun May 07, 2006 6:40 pm    Post subject: Reply with quote

kybber wrote:

If I have completely misunderstood something and am just making a fool of myself, please let me know ;)

well, i am not in this developing progress at all (just a user), but i can ensure you, that at least to the current state eveything is behaveing fine using latin1. if you switch a few pages back in this thread, CHTEKK already explained what you are asking for just right now. i actually posted the very same question myself a few weeks ago already ;)

for about using UTF8 completly, this IMHO depends on your php application. for example, coppermine behaved fine like a charm using UTF8, phpBB did not.
simply said: if coppermine would have been my only php application, i wouldnt even been in this thread just because everything worked like it used to be.

my *guess* ist, that some php applications are simply not "ready yet" to use UTF8. i could be wrong, though.. i am using german umlauts in coppermine as well. hmm..
Back to top
View user's profile Send private message
arkepp
n00b
n00b


Joined: 23 Jul 2002
Posts: 74
Location: NYC / USA (or Norway)

PostPosted: Sun May 14, 2006 3:40 am    Post subject: Reply with quote

Hi,

just wanted to let you all know that I got some really excellent answers in a new topic I started about converting the database to utf-8, also explains how to stick with latin1:

https://forums.gentoo.org/viewtopic-p-3316242.html#3316242
Back to top
View user's profile Send private message
cantao
Apprentice
Apprentice


Joined: 07 Jan 2004
Posts: 166

PostPosted: Fri Jul 21, 2006 2:21 am    Post subject: No luck yet... Reply with quote

Hi Friends!

Most thrilling situation in my life :) Guess I've lost some weight... :cry:

Ok, situation is as follows: I'm running Mediawiki with php-4.4.2-r2, mysql-4.1.14-r1 (since the install of Mediawiki, so no troubles from the original 4.1.14) and apache-2.0.58. Mysql is running with latin1 via my.cnf (no latin1 USE flag for this ebuild).

Everything was quite fine 'till I tried to upgrade to mysql-4.1.20. Ok, no accents (language is Brazilian Portuguese), only funny characters. Gentoo Forums to the rescue.

None of the solutions worked. Worse, downgrading to 4.1.14-r1 *didn't* fix the problem! Oh, the horror! 4.1.20 changed something just merely by starting! 8O

I've had to restore the original /var/lib/mysql directory in order to get the Wiki working again (phew!).

Did I miss something on the thread, or I must forcefully move everything to utf-8?

Best regards for everyone, Cantão!
Back to top
View user's profile Send private message
arkepp
n00b
n00b


Joined: 23 Jul 2002
Posts: 74
Location: NYC / USA (or Norway)

PostPosted: Fri Jul 21, 2006 7:39 am    Post subject: Reply with quote

See the link in my previous post, you probably want to use the latin1 USE-flag.
Back to top
View user's profile Send private message
cantao
Apprentice
Apprentice


Joined: 07 Jan 2004
Posts: 166

PostPosted: Fri Jul 21, 2006 11:36 am    Post subject: latin1 USE flag Reply with quote

Hi arkepp!

Yes, it was the first thing I tried. To be honest, I tried it even before consulting the forums. I have an habit of checking the USE flag dance before upgrading sensible packages. When I saw this new flag I guessed it would be the right thing to do, given my DB is latin1.

I'll check on MySQL and Mediawiki sites to see if I can find something useful.

Anyway, thanks for your reply!

Regards, Cantão!
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Wed Aug 02, 2006 1:14 pm    Post subject: Reply with quote

If you want to upgrade to a database server which runs utf8 as default, but want to keep
a database as latin1 for any reason, and you are experiencing wrong international characters,
then you could try to modify the code to issue "SET NAMES latin1" immediately after the
db connection is made.

For the package that should have its database as latin1, locate the file which contains the db
driver and find the line which runs the command mysql_connect. It should look something
like this, but will of course vary from app to app (example from IPB: ips_kernel/class_db_mysql.php):
Code:
$this->connection_id = mysql_connect( $this->obj['sql_host'] , $this->obj['sql_user'] , $this->obj['sql_pass'] );

In this case, adding the following immediately below solved the character problem:
Code:
mysql_query("SET NAMES latin1",$this->connection_id);


After saving the file, try to reload the faulty page. If it didn't work, just undo the change
and you are at least back to square one.

Disclaimer: I take absolutely no responsibility if you manage to kill your system. Backups is
a must-have whenever you modify code.
Back to top
View user's profile Send private message
cantao
Apprentice
Apprentice


Joined: 07 Jan 2004
Posts: 166

PostPosted: Tue Aug 08, 2006 7:02 pm    Post subject: Reply with quote

Well, I guess I'll take a deep breath and try to recreate the DB on another machine, converting it from latin1 to UTF-8 during the proccess. At least I can keep the original site running without destroying anything :-D

Thanks a lot, Cantão!
Back to top
View user's profile Send private message
cantao
Apprentice
Apprentice


Joined: 07 Jan 2004
Posts: 166

PostPosted: Mon Aug 21, 2006 1:20 pm    Post subject: Ok, please help me to understand... Reply with quote

Hi Friends!

Ok, now I am really confused :lol:

As I said previously, I have a Mediawiki installation running fine with latin1, mysql-4.1.14-r1 and php-4.4.2-r2. Tried to upgrade to mysql-4.1.20 (with USE="latin1") and nothing worked as expected. Reverted back to the working setup.

To avoid destroying the original site, I decided to create a local test site. So I have put together apache-2.0.58-r2, php-4.4.3-r1 and mysql-4.1.21 and have set mediawiki up. Now I have two scenarios:

1. Dumped the original wiki contents in latin1 using mysqldump. File: original.sql. Loaded this file into mysql, pointed mediawiki to it and...disaster. Everything is set to latin1 in my.cnf, as suggested in this thread.

All links are corrupted (the links are in Portuguese, so they contain things like "ãáõé", etc). For some weird reason, Firefox thinks that all pages are UTF-8. If I choose ISO-8859-1 as the encoding in Firefox, the article is displayed fine, but links still don't work as expected.

2. Converted original.sql to utf8.sql using iconv. Loaded into a different database, pointed mediawiki to it and... voilá! Almost everything is working fine again! (1 single page is corrupted). Note that I am still using latin1 on my.cnf. Changing my.cnf to use utf-8 again puts the wiki on an unuseable state.

Resuming: importing a latin1 database with latin1 on my.cnf -> disaster. Importing a utf-8 converted database with latin1 on my.cnf -> heaven. The same utf-8 database with utf-8 on my.cnf -> disaster.

Unfortunatelly I am completely unable to live with "well, it's working, lets leave it alone", because I am pretty sure it will cause problems in the future :-D

So, any non supernatural explanation to this mess?

Thanks a lot, Cantão!
Back to top
View user's profile Send private message
drak
n00b
n00b


Joined: 18 Jun 2003
Posts: 40

PostPosted: Mon Oct 02, 2006 12:33 pm    Post subject: Reply with quote

I had this issue after a recent upgrade to my gentoo system
Code:

Bugzilla Output:
DBD::mysql::st execute failed: Illegal mix of collations
(utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for
operation 'case' [for Statement "update bugs
set
(cut update parameters)[/url]
    bug_status = CASE WHEN bug_status IN('NEW', 'REOPENED', 'ASSIGNED',
'UNCONFIRMED') THEN (CASE WHEN everconfirmed = 1 THEN 'NEW' ELSE
'UNCONFIRMED' END) ELSE bug_status END,
    assigned_to = 41 where bug_id = 379"] at Bugzilla/DB.pm line 84
        Bugzilla::DB::SendSQL('update bugs\x{a}set\x{a}    rep_platform =
\'ALL PODS\',\x{a}    priority...') called at /bugzilla/process_bug.cgi
line 1657


Here's the fix I used to solve the problem

Taken from http://textsnippets.com/posts/show/84
Code:

mysqldump --user=username --password=password --default-character-set=latin1 --skip-set-charset bugs > dump.sql
sed -i "" 's/latin1/utf8/g' dump.sql
mysql --user=username --password=password --execute="DROP DATABASE bugs; CREATE DATABASE bugs CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql --user=username --password=password --default-character-set=utf8 bugs < dump.sql


in my.cnf I have utf8 as all my default settings
Back to top
View user's profile Send private message
sceptiq
Tux's lil' helper
Tux's lil' helper


Joined: 29 Nov 2004
Posts: 103

PostPosted: Fri Oct 20, 2006 1:37 am    Post subject: Reply with quote

sry my englisch is really bad... i dont understand that all so what plz tell me what is the sollution for that problem?
Back to top
View user's profile Send private message
jal
n00b
n00b


Joined: 27 Nov 2006
Posts: 1

PostPosted: Mon Nov 27, 2006 6:05 pm    Post subject: Sollution Reply with quote

Had the same problem after a mysql 3.x upgrade, åäö didn't work, I'm running mysql 4.1.21, php 5.1.6. I've recently solved this issue:

Add latin1 to USE in /etc/make.conf and then recompile mysql.
Code:
emerge =dev-db/mysql-4.1.21

Add or change in /etc/mysql/my.cfn
Code:

[mysqld]
character-set-server       = latin1
default-character-set      = latin1

Add or change in /etc/php/apache2-php5/php.ini
Code:

default_charset = "iso-8859-1"


Restart mysql and apache and åäö etc works!

/JAL
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Wed Dec 13, 2006 11:04 pm    Post subject: Reply with quote

If you have MySQL running on one host and an application using
UTF 8 querying the database on another, then you may run into
problems when using the "minimal" USE flag.

I have phpBB running on one host, and MySQL on another. After
updating MySQL with the minimal USE-flag on the phpbb-host,
UTF-characters broke and were drawn as squares. I removed the
minimal flag, recompiled MySQL and all was back to normal. The
single post i made while using the minimal MySQL turned up okay
until I had recompiled. Afterwards it contained the well-known dual
characters for æ, ø and å.

Please don't ask me to explain; this is just what I experienced,
and I am not going to fight or ponder about UTF8 any more than I
have to ;)
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Fri Dec 15, 2006 12:32 pm    Post subject: Reply with quote

kybber wrote:
If you have MySQL running on one host and an application using
UTF 8 querying the database on another, then you may run into
problems when using the "minimal" USE flag.


Why that happened is quick to explain... The "minimal" USE flag is really minimal and thus, when used, doesn't compile support for any extra charset, and that's probably why it couldn't correctly read/write from the other mysql server with the different charset.
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Fri Dec 15, 2006 12:36 pm    Post subject: Reply with quote

Cheers! Seeing how UTF8 is now the default character set, this is sort
of counter-intuitive behaviour. At least to me. I guess that means it
is not possible to install the MySQL client only and have it behave as
expected?
Back to top
View user's profile Send private message
llongi
Retired Dev
Retired Dev


Joined: 15 Apr 2004
Posts: 459
Location: Switzerland

PostPosted: Fri Dec 15, 2006 1:14 pm    Post subject: Reply with quote

kybber wrote:
Cheers! Seeing how UTF8 is now the default character set, this is sort
of counter-intuitive behaviour. At least to me. I guess that means it
is not possible to install the MySQL client only and have it behave as
expected?


Well yeah, it should work and support UTF8-only then, I just checked and indeed the minimal configure in our ebuilds omits to set any charset, and disables the extra ones, so you always get a latin1-mysql with support for no extra charsets... I've fixed it so that it sets the correct charset now (utf8 by default, latin1 if USE latin1 is set or if MySQL <4.1), but it still won't compile/install all the extra ones. I'll commit the fix in a few hours, thanks for noticing this!
_________________
Best regards, Luca.
Back to top
View user's profile Send private message
kybber
Apprentice
Apprentice


Joined: 25 Jun 2002
Posts: 228
Location: Trondheim, Norway

PostPosted: Fri Dec 15, 2006 1:16 pm    Post subject: Reply with quote

Wow, thanks for the quick fix! :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum