Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58906 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64160 invoked from network); 12 Mar 2012 22:57:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2012 22:57:50 -0000 Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:54613] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/6A-13375-D6F7E5F4 for ; Mon, 12 Mar 2012 17:57:50 -0500 Received: by werh12 with SMTP id h12so4593638wer.29 for ; Mon, 12 Mar 2012 15:57:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=EUh2GfKr61WKl2ScSGtT6UoR6/ZnsvHKDEvGswxvg7g=; b=m//oMvTcjV0WBqfF6n7uzGH+ZnZ4y6dAyuj/F4SIal6pgWcUAU9l8qiYmr1Jl+6E+0 H2QuK70qcB/vOPA1jvtOI9vv6RghKokmIybQj1dx1+UPDg+oBVfJHx+fqqTZtnIZhFBa 77iKq7MxA4bGaBdoaJSPE+PrsXUroBIsjfPFX4KOqMU496TVZJc+TK8x6orHN9bZDgxX GFNHgW5DRPwDZ5xOAFBwBi6gu182atsNZy7QDAC19lYi8gedWZAjQj1/e/uGTRAF6tki M3bWGABvk90KmeA0nyZ+g9Tu9NSE7pS2Wvuk+3rnIjD6nbrBLj4QgR9r8tG2ubmHnIbi VoSQ== Received: by 10.180.83.97 with SMTP id p1mr1785151wiy.19.1331593066488; Mon, 12 Mar 2012 15:57:46 -0700 (PDT) Received: from [192.168.1.26] (60.Red-83-41-228.dynamicIP.rima-tde.net. [83.41.228.60]) by mx.google.com with ESMTPS id n8sm64200245wix.10.2012.03.12.15.57.44 (version=SSLv3 cipher=OTHER); Mon, 12 Mar 2012 15:57:45 -0700 (PDT) Message-ID: <4F5E7F66.6000304@gmail.com> Date: Mon, 12 Mar 2012 23:57:42 +0100 User-Agent: Thunderbird MIME-Version: 1.0 To: Stas Malyshev CC: Rasmus Lerdorf , PHP internals References: <4F5D9C77.3030000@lerdorf.com> <4F5DA152.10109@sugarcrm.com> <4F5DA894.8060606@lerdorf.com> <4F5DAB49.3030808@sugarcrm.com> <4F5DAFCE.8020600@lerdorf.com> <4F5E5148.4030106@sugarcrm.com> <4F5E5219.7080501@lerdorf.com> <4F5E53C3.8060502@sugarcrm.com> <4F5E6A0C.90507@gmail.com> <4F5E6AF4.9090603@sugarcrm.com> In-Reply-To: <4F5E6AF4.9090603@sugarcrm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] default charset confusion From: keisial@gmail.com (=?UTF-8?B?w4FuZ2VsIEdvbnrDoWxleg==?=) 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).