Bug #67451 [Opn->Nab]: MD5 and national characters
| From: | johannes@php.net | Date: | Mon, 16 Jun 2014 10:04:46 +0000 |
| Subject: | Bug #67451 [Opn->Nab]: MD5 and national characters | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186205@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67451&edit=1
ID: 67451
Updated by: johannes@php.net
Reported by: frenky dot pv at atlas dot cz
Summary: MD5 and national characters
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Win2012, 64bit
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
PHP knows little about encodings the md5() function works on the binary string array which uses
whatever encoding you are using to save your file. From a quick test it seems your database uses
UTF-8 while your code uses Latin 1 (ISO-8859-1)
$ cat t.php
<?php
echo md5('házená');
$ php t.php
6270f1b53a892b56531f91e66d5d7139
$ iconv -f utf-8 -t iso-8859-1 t.php | php
3d560aed38ceab4eb6892b7aa377d39a
Previous Comments:
------------------------------------------------------------------------
[2014-06-16 09:03:54] frenky dot pv at atlas dot cz
Description:
------------
PHP:
md5('házená') = 3d560aed38ceab4eb6892b7aa377d39a (wrong)
MySQL:
SELECT MD5('házená') = 6270f1b53a892b56531f91e66d5d7139 (correct)
'házená' is the Czech word translation into English 'handball'.
Have something similar was written:
http://cz1.php.net/manual/en/function.md5.php#31238
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67451&edit=1