Edit report at http://bugs.php.net/bug.php?id=50297&edit=1

 ID:                 50297
 Comment by:         clicky at erebot dot net
 Reported by:        pby_42-web at yahoo dot fr
 Summary:            MessageFormatter::formatMessage don't support string
                     with accent in it
 Status:             Bogus
 Type:               Bug
 Package:            I18N and L10N related
 Operating System:   Windows Vista 64
 PHP Version:        5.3.1
 Block user comment: N

 New Comment:

@pby_42-web at yahoo dot fr: I guess your string is encoded in
ISO-8859-15.

AFAICT, ICU only accepts strings encoded in UTF-8. Converting your
string in UTF-8 and using hexadecimal escape sequences, I got the
following result:



$ php -a

Interactive shell



php > echo MessageFormatter::formatMessage("fr_FR", "with accent
\xC3\xA9 \xC3\xA0", array());

with accent é à

php >



So, MessageFormatter DOES accept accentuated letters, you just have to
be careful about their encoding. Maybe the documentation should be
updated to state this more clearly.


Previous Comments:
------------------------------------------------------------------------
[2009-11-29 13:07:32] pby_42-web at yahoo dot fr

No, formatMessage is a static function.



>From the doc: 

static  string  formatMessage  ( string $locale  , string $pattern  ,
array $args  )

------------------------------------------------------------------------
[2009-11-27 17:47:45] j...@php.net

Well there's your problem. The method isn't static..

------------------------------------------------------------------------
[2009-11-27 15:08:49] pby_fr at yahoo dot fr

formatMessage being a static method, it is not possible to use
getErrorMessage!



I tested with a full object code:



$fmt = new MessageFormatter("fr_FR", "with accent à é");



$fmt isn't an object, but FALSE





Whit

$fmt = new MessageFormatter("fr_FR", "with accent a e");

$fmt is an object, and everything works fine.



Anyway, I must switch back to PHP 5.2, therefore I will recode a very
simple formatter instead of use this class.

------------------------------------------------------------------------
[2009-11-26 10:08:22] j...@php.net

Try this:



  http://www.php.net/manual/en/messageformatter.geterrormessage.php



You might have something like wrong locale there or something..

------------------------------------------------------------------------
[2009-11-25 20:37:49] pby_42-web at yahoo dot fr

Description:
------------
Using accent character in the pattern of MessageFormatter::formatMessage
return an empty string.



Reproduce code:
---------------
echo (MessageFormatter::formatMessage("fr_FR", "with accent à é",
array()));

Expected result:
----------------
to display: with accent à é

Actual result:
--------------
display nothing


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50297&edit=1

Reply via email to