| Index
» Projekty
» phpMyEdit
» Fórum
» using [SET NAMES] |
 |
atara
Založený: 09.07.2009
Príspevky: 3
Zaslal: 2009-07-09 14:11
Návrat hore
Odpovedať s citátom
|
In my DB there are some fields in Hebrew. When reading them using PHP I use
| Kód: |
SET NAMES "hebrew";
. . . query code . . .
|
I tried to show\change Hebrew fields using -
| Kód: |
$opts['fdd']['fieldName']['sql'] = 'SET NAMES "hebrew"; TRIM(fieldName)';
|
but it does not work.
Any hints are welcomed!
Atara
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2009-07-09 22:02
Návrat hore
Odpovedať s citátom
|
"Approximately" following the example below, you will instead need to hack the class file where the connection is actually made. Search using your text editor in the class file for "function execute" and add your code there.
| Kód: |
// existing line
if ($this->connect() == false) { return false; }
// new UTF8 connection.
if(!@mysql_query('SET NAMES UTF8')){ error(mysql_error()); }
if(!@mysql_query('SET COLLATION_CONNECTION=UTF8_GENERAL_CI')){ error(mysql_error()); } |
|
sagiben
Založený: 27.01.2009
Príspevky: 15
Zaslal: 2009-07-10 07:43
Návrat hore
Odpovedať s citátom
|
I'm using PME with Hebrew, and had to make the following changes in order to display Hebrew content.
1. For each table I defined :
| Kód: |
$opts['language'] = 'HE-IL-UTF8';
|
2. At the beginning of each html page I put :
| Kód: |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
3. Added the following lines at the end of sql_connect function
| Kód: |
if(!mysql_query("SET NAMES hebrew",$this->dbh))
die('Could not set hebrew' . mysql_error());
|
Sagi
|
atara
Založený: 09.07.2009
Príspevky: 3
Zaslal: 2009-07-12 08:19
Návrat hore
Odpovedať s citátom
|
Thanks, we will try it.
Atara
|
atara
Založený: 09.07.2009
Príspevky: 3
Zaslal: 2009-07-12 10:49
Návrat hore
Odpovedať s citátom
|
Here are the changes I made:
1. In the page:
1.1
| Kód: |
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1255">
instead of -
charset=iso-8859-1"
|
1.2
| Kód: |
$opts['language'] = 'HE-IL';
instead of -
//!! $opts['language'] = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];
|
2. In phpMyEdit.class.php, function connect(), at the end of the function, I added :
| Kód: |
$query = 'SET NAMES hebrew';
$res = $this->myquery($query, __LINE__);
if ($res == false) {
$this->error('could not set hebrew ' . mysql_error(), $query);
return false;
}
// else continue -
return true;
} /* end of function connect() */
|
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|