www.webdeveloper.com
Results 1 to 5 of 5

Thread: json_encode utf8 problem

  1. #1
    Join Date
    Oct 2012
    Posts
    15

    json_encode utf8 problem

    Hi everyone

    <?php echo json_encode(utf8_encode($this->recipe['recipe_name']), JSON_ERROR_UTF8); ?>

    $this->recipe['recipe_name'] is calling a Mysql Database data,

    and the output in the web file as just quotation.

    at this point, I've looked at various tutorials and I can't figure out what is the problem.

    help?

    Thanks!

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,157
    I believe JSON_ERROR_UTF8 only has meaning within the context of the return value from json_last_error() (see example 1).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Oct 2012
    Posts
    15
    how do I show the the data in the database?

    I have tried many json_encode JSON_ERROR_UTF8 etc. and not working at all.

    I have it reading a post name with hyphens to replace spaces.
    how do I have the url to handle hyphens for SEO purposes in php MVC format?

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,157
    I think I need an explanation of what you're ultimately trying to accomplish with all this encoding? If it's just to get it to work in a URL, perhaps all you need is url_encode()?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Oct 2012
    Posts
    15
    in my MySql database, I have url slugs, to replace spaces with hyphens, and I wan't it to read by that column with those slugs, and its not reading that certain row, or not displaying the content, and I need some help on how to make that work

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles