Page 1 of 1

UTF8 with MySQL 4.1

Posted: 22 Oct 2005, 19:54
by denny
hi,

how can i get UTF8 working, with MySQL 4.1? UTF-8 is now default. The german umlaute (äöü and ß) gets broken.

how can i change from ISO-8859-1 to UTF-8 ?

Posted: 20 Dec 2005, 15:29
by tria1312
Did you resolve this problem? Cause I have the same ...

utf

Posted: 21 Dec 2005, 08:38
by MaKARON
I didn't try, but you can :-)
change all create table ...; to:
create table ... ) character set utf8;

or try this all on tables:
ALTER TABLE ___insert_table_name___ CHARACTER SET utf8;

Please report effects on forum.

Regards

Posted: 26 Dec 2005, 07:11
by stonez
To make your MySQL using UTF8 encoding, just create the DB under phpMyAdmin and select 'utf8_unicode_ci' in 'Collation' dropdown.

Then go ahead to run the install script.

Worked for MySQL 4.1.x

Posted: 26 Dec 2005, 08:04
by Stonez
stonez wrote:To make your MySQL using UTF8 encoding, just create the DB under phpMyAdmin and select 'utf8_unicode_ci' in 'Collation' dropdown.

Then go ahead to run the install script.
After this, you have to add statements in
/Mantis/core/database_api.php

Find

Code: Select all

function db_connect( $p_dsn, $p_hostname = null, $p_username = null, $p_password = null, $p_database_name = null ) {
		global $g_db_connected, $g_db;

		if(  $p_dsn === false ) {
			$g_db = ADONewConnection( config_get_global( 'db_type' ) );
			$t_result = $g_db->Connect($p_hostname, $p_username, $p_password, $p_database_name );
		} else {
			$g_db = ADONewConnection( $p_dsn );
			$t_result = $g_db->IsConnected();
		}
		
		if ( !$t_result ) {
			db_error();
			trigger_error( ERROR_DB_CONNECT_FAILED, ERROR );
			return false;
		}else{
			//Added by Stonez to add UTF8 encoding to MySQL 2005-12-26
			$g_db->Execute("SET NAMES UTF8");
		}

		$g_db_connected = true;

		return true;
	}
Mainly adding this to Mysql to tell Mysql this is a UTF8 encoding

else{
$g_db->Execute("SET NAMES UTF8");
}


You have to do the same for function_pconnect()

Done.

Ummm...

Posted: 24 Jan 2006, 20:02
by Guest
[quote="Stonez"][/quote]

Ok. When was the first time you heard about "" or ""?

The page encoding

Posted: 10 Jan 2007, 10:52
by len
For anyone which finds this topic searching for utf-8 encoding maybe the problem is not in the database but in the page encoding and it suffices to change the files lang/strings_english.txt and the others by replacing

$s_charset = "windows-1252";
with:
$s_charset = "UTF-8";

as I did on the process of migrating from mysql 4.0 to 5.0 http://www.len.ro/work/tools/migrating- ... -0-to-5.0/

Hope it helps,
Len