php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42295 mcrypt outputs are latin1 instead of utf8
Submitted: 2007-08-14 12:44 UTC Modified: 2007-08-14 13:31 UTC
From: webmaster at philcorda dot de Assigned:
Status: Not a bug Package: mcrypt related
PHP Version: 5CVS-2007-08-14 (CVS) OS: Suse Linux 9.3
Private report: No CVE-ID: None
 [2007-08-14 12:44 UTC] webmaster at philcorda dot de
Description:
------------
Today, I tried to use mcrypt with utf8.
The background was a mysql-connection running in utf8-mode and for this reason all the transfered strings have to be encoded in utf8.
I set the default charset in the php.ini to utf-8 and php works fine but then I tried to encrypt strings with mcrypt and all the strings where given out in latin1 / ISO-8859-1 instead of utf-8.

I don't know why mcrypt delivers the strings in latin1 instead of utf-8 but I would be happy if this bug could be solved 'till next version.

For this time I'll use utf8_encode().

Reproduce code:
---------------
Irrelevant

Expected result:
----------------
utf-8 strings

Actual result:
--------------
latin1 strings

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-14 12:57 UTC] johannes@php.net
mcrypt produces binary output which is neither iso-8859-1 nor utf-8 therefore you should tell your database that that data is binary stuff, not text data.
 [2007-08-14 13:31 UTC] webmaster at philcorda dot de
Thanks, that's a good way but when I print the output of mcrypt with echo then it's definitively ISO-8859-1/latin1.
All the other chars on the webpage you can see but only these strings are questionmarks. When you change your charset to ISO you can see them! So I think it's ISO --> When it's binary why does it give out ISO with echo?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 09:01:27 2024 UTC