2

I am now working on Japanese projects. When I use var_dump() the japanese characters are not show correctly in browser. But English characters are showing correctly. How can I fix this problem. The following is portion of my var_dump() result,

  'id' => int 71680
  'customer_id' => int 16161
  'amount' => string '1' (length=1)
  'second_customer_id' => null
  'second_amount' => null
  'customer_name' => string '飛知和 啓一' (length=18)
  'second_customer_name' => null
  'payment_flag' => string '掛' (length=3)
  'payment_flag_id' => int 2
  'order_id' => int 9108
  'article_name' => string '祭壇' (length=6)
  'article_id' => int 1000001
  'sales_price' => string '200000.0' (length=8)
  'discount' => int 0
  'ceremony_cooking_category_id' => null
  'payment_date' => string '2014/12/05' (length=10)
  'payment_hour' => string '0' (length=1)
  'payment_min' => string '0' (length=1)
  'hall_id' => null
  'hall_name' => null
  'hall_address' => null
  'hall_tel' => null
  'stock_date' => null
  'stock_confirm_emps_name' => null
  'check_date' => null
  'check_emps_name' => null
  'note' => string 'memo 333' (length=8)
  'label' => string 'label 333' (length=9)
Nyein Chan
  • 1,215
  • 2
  • 17
  • 32
  • can you post your head here as well, if you are confuse you need to tell hi to use utf-8, if you are not doing that it will a problem – user2860957 Apr 26 '17 at 01:43
  • @user2860957 What do you mean head? Do you mean html head tag? Will you please explain me? – Nyein Chan Apr 26 '17 at 01:47
  • i might be wrong, as var dump dont return an thing, but i am thinking using head and telling it use utf-8 can help you, and yah i mean html head some thing like ` ` – user2860957 Apr 26 '17 at 01:49
  • i checked it on my end, is fine, are you returning these values from database?? – user2860957 Apr 26 '17 at 01:55
  • @user2860957 Yes, those values are from database. – Nyein Chan Apr 26 '17 at 02:26
  • read this link http://php.net/manual/en/mysqli.set-charset.php, in short you have to use mysqli set charset, but read the link, as it may 100 reason, so its better you read the link – user2860957 Apr 26 '17 at 02:35

2 Answers2

4

add

Header("Content-Type:text/html;charset=utf8");

before your var_dump, change utf8 to the encoding your database use.

tcPeng
  • 296
  • 1
  • 11
1

use Content-Type: text/plain and charset=utf-8, this force the output to render as plain text.

add this line before outputting anything.

header("Content-Type: text/plain; charset=utf-8");

Reference : Charset W3

Touheed Khan
  • 2,149
  • 16
  • 26