PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, November 2, 2022

[FIXED] What is the locale of UTF-8?

 November 02, 2022     c, encoding, facebook-graph-api, locale, utf-8     No comments   

Issue

I am getting an XML file from the Facebook API with the data:

<?xml version="1.0" encoding="UTF-8"?> 
<fql_query_response xmlns="api.facebook.com/1.0/"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; list="true"> 
    <user> 
        <uid>100000022063315</uid> 
        <name>0xD7 0x99 0xD7 0x95 0xD7 0x97 0xD7 0x90 0xD7 0x99 0x20 0xD7 0x95 0xD7 0x9B 0xD7 0x98 0xD7 0xA8</name> 
    </user>
</fql_query_response>

I want to translate the UTF-8 to wchar_t. I am trying to do so with mbstowcs but apparently I need to know what locale to set. Is there a standard locale for Facebook? or for UTF-8?


Solution

To translate data that's not associated with the user's configured locale, but rather an explicitly specified encoding, you should use iconv, not mbsrtowcs. You don't need setlocale at all for this.



Answered By - R.. GitHub STOP HELPING ICE
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing