On 12/03/12 22:30, Stas Malyshev wrote:
> Hi!
>
>> If you are a framework developer, and really want to shield against a
>> bad php.ini setting, you could ini_set() to your prefered charset at the
>> beginning of the request.
>
> That assuming "the request" is completely processed by your framework
> and you never call any outside code and any outside code never calls
> you - otherwise your messing with INI setting may very well break that
> code or that code's messing with INI settings may very well break yours.
Sure. That's a setting to be kept the same for the request unless you
like trouble.
If you need to call a library function which uses a different html
charset convention you could do so through a wrapper, which sets and
restores the setting.
Still, that API is likely wrong: a library function written by someone
completely unrelated to the main application shouldn't be echoing
anything through the output. And if it's not generating the html, the
htmlspecialchars is better done from the return at the calling
application (probably after converting the internal charset).
Such interfaces may be well served by switching the setting many times.
I was only advocating the usage of ini_set() once in the request,
for the case of a server with two applications having different needs
(equivalent to configuring it on .user.ini or .htaccess).

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to