php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51321 shows same ascii for two diferent french characters
Submitted: 2010-03-18 12:12 UTC Modified: 2010-03-21 20:04 UTC
From: sharad dot tale at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.2 OS: windows xp
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sharad dot tale at gmail dot com
New email:
PHP Version: OS:

 

 [2010-03-18 12:12 UTC] sharad dot tale at gmail dot com
Description:
------------
shows same ascii for two different french characters

Test script:
---------------
<?php

$char1="à";
$chart2="Ã";

echo "Ascii for char1 is =".ord($char1);
echo "<br/>";
echo "Ascii for char2 is =".ord($char2);
?>

Expected result:
----------------
Ascii for char1 is = 224
Ascii for char1 is = 195

Actual result:
--------------
Ascii for char1 is = 195
Ascii for char1 is = 195

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-18 12:14 UTC] sharad dot tale at gmail dot com
Expected result:
----------------
Ascii for char1 is = 224
Ascii for char2 is = 195

Actual result:
--------------
Ascii for char1 is = 195
Ascii for char2 is = 195
 [2010-03-21 20:04 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-03-21 20:04 UTC] johannes@php.net
You're script is encoded using Utf-8 therefore à and à are multibyte characters. ord() gives you the value of the first byte.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 16 16:00:03 2025 UTC