FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » encoding
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: encoding [message #186328 is a reply to message #186327] Thu, 26 June 2014 11:20 Go to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
Denis McMahon wrote:

> htmlentities( $string, ENT_COMPAT, "UTF-8" );
>
> Not sure if I actually need the setlocale or not. Seems to work without
> it.

In PHP < 5.4 the default of the 3rd parameter is 'ISO-8859-1', so
setting this parameter appropriately is important when $string may
contain non ASCII characters. For instance:

htmlentities("\xC3\xA4", ENT_COMPAT, 'ISO-8859-1');
// => '&Atilde;&curren;'

htmlentities("\xC3\xA4", ENT_COMPAT, 'UTF-8');
// => '&auml;'

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: SplFileObject always returns an extra "last" line -- why?
Next Topic: how to revise my User Contributed Note on php.net
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri May 17 09:46:03 GMT 2024

Total time taken to generate the page: 0.05474 seconds