php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47347 Feature request: add 3rd optional argument - the character encoding
Submitted: 2009-02-09 11:43 UTC Modified: 2009-02-09 12:11 UTC
From: glideraerobatics at hotmail dot com Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.2.9RC1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: glideraerobatics at hotmail dot com
New email:
PHP Version: OS:

 

 [2009-02-09 11:43 UTC] glideraerobatics at hotmail dot com
Description:
------------
Feature request

As you can see here: http://nl3.php.net/manual/en/function.json-encode.php
people are jumping through hoops to encode variables of non-utf8 encodings into JSON format.

Why not just centralize that magic into the function itself as a new 3rd optional argument $encoding that defaults to UTF-8?


Reproduce code:
---------------
n/a

Expected result:
----------------
n/a

Actual result:
--------------
n/a

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-09 12:11 UTC] scottmac@php.net
JSON is a core enabled by default module, adding something that can encode from X to utf-8 will add a dependency and it's not always going to know what was and wasn't intended.

Consider either using utf-8 in all of your code or base64 encode your non unicode strings.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC