php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20166 Unicode (Slovenian) characters are not displayed correctly
Submitted: 2002-10-30 02:45 UTC Modified: 2003-03-11 19:40 UTC
From: miha dot valencic at mobitel dot si Assigned:
Status: Not a bug Package: *Languages/Translation
PHP Version: 4.2.2 OS: Win2k
Private report: No CVE-ID: None
 [2002-10-30 02:45 UTC] miha dot valencic at mobitel dot si
The problem is with Microsoft SQL Server 2000 and with MySQL version  Ver 11.18 Distrib 3.23.52, for Win95/Win98 (i32).

I have a database with slovenian characters in the fields and I am not able to display them properly with php extension modules. I can display them propery using COM ADO objects. I've included a simple script, that shows what I am trying to do. The ADO portion of the script produces the desired result. The characters are entered using windows-1250 codepage.

The script:
<PRE><?
	header("Content-Type", "text/html; charset=Windows-1250");
?>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
</head>
<body>
<? 
$conn = new COM("ADODB.Connection") or die("Cannot start ADO"); 

$conn->Open("PROVIDER=MSDASQL;DRIVER={SQL SERVER}; Server=SRRDEV2;Database=portal;UID=sa;PWD=srrdev2;"); 
// SQL statement to build recordset. 
$rs = $conn->Execute("SELECT * FROM TblInfo_News where IID = 3034326"); 

while (!$rs->EOF) { 
$fv = $rs->Fields("title"); 
echo "title: ".$fv->value."<br>\n"; 
$rs->MoveNext(); 
} 
$rs->Close(); 
?> 


PHP Mssql extension:<br>
<?
	$link = mssql_connect("srrdev2.mobitel.si", "sa", "srrdev2");

	if($link) {
		if(mssql_select_db("portal", $link)) {
			$query = "SELECT * FROM TblInfo_News  where IID = 3034326";

			$result = mssql_query($query, $link);
			if($result) {
				if(mssql_num_rows($result)) {
					while($row = mssql_fetch_array($result)) {
						echo "title: " . $row['title'] . "<BR>";
					}
				} else {
					echo "No results! <BR>";
				}
				mssql_free_result($result);
			} else {
				echo "Could not get the result!<BR>";
			}


			mssql_close($link);
		} else {
			echo "Could not select db!<BR>";
		}
	} else {
		echo "Could not connect!<BR>";
	}

// mysql

	echo "MYSQL<BR>";
	$link = mysql_connect("valencicm.mobitel.si", "root", "root")
        or die("Could not connect");

	mysql_select_db("test");
	$query = "SELECT * FROM tbl1";
	$result = mysql_query($query);
	if($result) {
		$row = mysql_fetch_array($result);
		if($row) {
			echo "String: " . $row['fld1'];
		}
		mysql_free_result($result);
	}
	mysql_close($link);

?>
</body></PRE>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-30 07:05 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2002-11-05 00:29 UTC] miha dot valencic at mobitel dot si
Hi!

To define more clearly: 

I have a Microsoft SQL database. In that database, there are many articles, with pictures, etc. I tried to access those articles using php, and wanted to display them. All is fine, but, instead of slovene characters 蚞 (which you probably don't see anyway) I get garbles (unrecognized characters). I was using mssql_* functions to retrieve the data. Then, I created a simple table in mysql, inserted a row manually (from the console) and the same thing happens. BUT, if I insert the items trough PHP the first time, than the characters are retrieved correctly. So I suspect there must be something with encoding, perhaps. To make things even more funny, when I used ADO COM object to access the MS SQL server, the strings retrieved are fine.

I apologize if I posted this under the wrong category, but I could not decide whether it is a db problem or not. Feel free to move this item to another category, if you wish.

System details: SQL Server: Win2k, Slovenian locale
PHP system: Win2k, Apache 1.3.26 (Win32), PHP 4.2.2, mysql 3.23.52, Slovenian locale
 [2002-11-08 00:06 UTC] miha dot valencic at mobitel dot si
A simple output of the three versions:

MSSQL accessed trough ADO COM object:
title: Novela zakona o dr?avljanstvu ne re?uje ni?esar

PHP Mssql extension:
title: Novela zakona o dr?avljanstvu ne re?uje ni?esar

MYSQL  (entered trough command line)
String: ?秬?? string

MYSQL (entered trough php form)
String: 蚞 string
 [2003-01-18 15:13 UTC] moriyoshi@php.net
Doesn't your problem look like the one reported in the following bug report?

http://bugs.php.net/19474


 [2003-01-31 13:51 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-02-01 14:01 UTC] miha dot valencic at mobitel dot si
No, this bug is not like the one described in 19474. If you have suggestions on what kind of test should I also make, please let me know and I will try. 

Regards,
    m.
 [2003-03-11 19:40 UTC] sterling@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

we don't do anything tricky with codings.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Nov 16 03:01:26 2018 UTC