473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

mb_convert_encoding

I am running PHP version 5.2.0-8+etch3.

If I run mb_convert_encoding( $string, "UTF-8", "HTML-ENTITIES")
on a string containing "Е", it ought to produce the two bytes
whose decimal values are 208 149. But it produces the four bytes whose
decimal values are 242 175 184 159.

Is there a fix for this? Does a later version of PHP get it right, or
do I have to write my own conversion function?

Nick
--
Nick Wedd ni**@maproom.co.uk
May 23 '07 #1
1 3190
Nick Wedd <ni**@maproom.co.ukwrote:
I am running PHP version 5.2.0-8+etch3.

If I run mb_convert_encoding( $string, "UTF-8", "HTML-ENTITIES")
on a string containing "&#x0415;", it ought to produce the two bytes
whose decimal values are 208 149. But it produces the four bytes whose
decimal values are 242 175 184 159.

Is there a fix for this? Does a later version of PHP get it right, or
do I have to write my own conversion function?

Nick
--
Nick Wedd ni**@maproom.co.uk
Indeed, it is a bug: mbstring lacks support for numeric hex entities,
they are decoded as if were decimals, so 'x' becomes the "decimal digit"
'x'-'0'=120-48=72, from which the strange value you obtained. I already
sent a short patch to internalsATlists.php.net, hoping be the right place.

PS. If you are playing with such a conversion, chances are that your HTML
pages are not properly encoded. Sure you need to do that?

Best regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it

May 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tobias | last post by:
Hi! I had Apache 2.0.47 and PHP 4.3.0 DEV running successfully on a W2k Server. For some reason, I couldn't get PHP to read XML-Attributes with the DOM XML -functions. So I thought, it would be...
2
by: VK | last post by:
Hello All I am writing a string from the database into a text file which contains "Euro" symbol . I have tried using iconv() and utf_encode and mb_convert_encoding() functions to convert the...
2
by: Frank Thorstens | last post by:
Hi, i have a strange problem and don't know where to look for the bug. Ok, i have an html form witha text area. Very roughly i make something like this (PHP 4.2.3, i can't update the version):...
0
by: lawrence | last post by:
Okay, after a lot of searching, I finally found this. It is listed in the XML section of the manual, rather than the section that deals with strings. I feel strongly that it should be cross-listed:...
6
by: Jean-Marc Molina | last post by:
Hello, I'm trying to generate a RSS newsfeed using the DOM XML functions. However I can't find a way to use accentuated characters. I even tried to specify a character encoding set but it...
6
by: Oliver Spiesshofer | last post by:
Hi, I am trying to send emails with the php Mail function, but umlaut and other special characters are not displayed correctly. Actually they are replaced by large X's. I checked if there is an...
4
by: chris_fieldhouse | last post by:
Hi, I'm almost done with a php driven email filter and automated forwarder, I've tested it out with various emails and ironed out plain text and html. But this final item has me stumped. ...
2
by: Lucas Kruijswijk | last post by:
Hello, I am making some site, where I use UTF-8 encoding. From PHP I send mail. But, if possible I want to send the mail in ISO-8859-1 or KOI8-R (because still some mailers have problem with...
5
by: Timothy Madden | last post by:
Hello Is there a function that will allow me to output text written in utf-8 (from db for example) if my document has Content-Type: text/html; charset=ISO-8859-1 I mean htmlspecialchars()...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.