UTF8 with MySQL 4.1

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
denny
Posts: 1
Joined: 22 Oct 2005, 19:51

UTF8 with MySQL 4.1

Post 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 ?
tria1312

Post by tria1312 »

Did you resolve this problem? Cause I have the same ...
MaKARON
Posts: 13
Joined: 12 Dec 2005, 12:02
Location: Olkusz / Poland
Contact:

utf

Post 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
stonez

Post 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.
Stonez

Worked for MySQL 4.1.x

Post 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.
Guest

Ummm...

Post by Guest »

[quote="Stonez"][/quote]

Ok. When was the first time you heard about "" or ""?
len
Posts: 3
Joined: 10 Jan 2007, 09:49
Location: Bucharest, Romania
Contact:

The page encoding

Post 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
Post Reply