encoding - How to print a list of all ascii characters with php? -


i'm traying print ascii characters when index arrives extended characters appears question mark �. see image

for example, if echo chr(160); oa== when supposed á how can correct value without change header charset or file encoding?

im doing follow:

for ($i=0; $i < 255; $i++) {      echo chr($i) . " - "; } 

my file encoded utf-8. when set header iso-8859-1 appears good. see image

header("content-type: text/html; charset=iso-8859-1"); 

i tried print 1 character. see happen: 1- see value of variable , how print in browser.

2- see value of variable , how print in browser. why variable strange value.

you convert characters utf-8:

for ($i=0; $i < 255; $i++) {     echo mb_convert_encoding (chr($i), 'utf-8', 'iso-8859-1') . " - "; } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -