php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13839 mysql_db_query does converts EURO symbol
Submitted: 2001-10-26 11:15 UTC Modified: 2001-10-30 03:23 UTC
From: Martin_Rauch at web dot de Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.6 OS: Linux 2.2.18
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Martin_Rauch at web dot de
New email:
PHP Version: OS:

 

 [2001-10-26 11:15 UTC] Martin_Rauch at web dot de
Try this

$headline = "This is a € prize";
mysql_db_query( $db, "insert into article set headline='$headline'");

this would insert the string "This is a € prize"!

obviously the command mysql_db_query does a converting on the input string. But in this case the result would be
a false string.

Any help?
Martin

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-26 15:44 UTC] sander@php.net
mysql uses a different character-set than your browser does. Therefor, it prints character 128 (the euro-sign) different than most text-processors.
It is actually stored correctly, if you retrieve it (with i.e. PHP) and display it in your browser, it still is a euro-sign.
 [2001-10-29 07:30 UTC] Martin_Rauch at web dot de
It is not the problem of the character set. It is a matter of changing the data before it gets inserted into the database.
example:

the orginal string is "€"
the string that gets inserted by mysql_db_query is: "€"

-> the character "&" gets encoded into "&"!

Only the orginal string "€" displays an EURO character with the browser if you read it from the database
with php and display it in a HTML page.

Is there a way to tell mysql_db_query() not to touch the string before inserting it into the database??

Thanks
Martin
 [2001-10-30 03:23 UTC] jeroen@php.net
CHeck the contents of your database with the mysql command line tool. If it really says &, post your session here.

Mysql> SELECT headline FROM article;
...
Mysql>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC