0

I have this text "纽约黄金" from an api. When I use file_get_contents to get the data it displays ŦԼ�ƽ�.

I manage to convert it using this code.

$string = iconv(mb_detect_encoding($string, mb_detect_order(), true), "UTF-8", $string);

My problem is when I upload it to server, instead of showing the readable text, it displays nothing.

Hope you help me.

user123
  • 435
  • 1
  • 6
  • 23
  • are you serving the web pages UTF-8? –  Apr 05 '19 at 03:06
  • @tim yes, I check also the charset of that text its UTF-8 – user123 Apr 05 '19 at 03:08
  • Detect encoding is a misnomer; it guesses. If you know the encoding, use that and skip the guessing. If the API is over HTTP, the response header will likely declare the encoding. – Tom Blodget Apr 06 '19 at 10:44
  • Possible duplicate of [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – Dharman Sep 25 '19 at 13:04

0 Answers0