2017-11-01 1 views
-1

ASCII 문자로 문자를 번역하는 데 문제가 있습니다. "나" '또는'PHP ASCII 문자 번역 문제 function chr()

$txt = str_replace(chr(147), '"', $txt); // left double quote 

사람으로 인해 무엇인지 알 수있는 코드의

부와 같은 예 드문 따옴표, 당신이 문자열

+0

147 큰 따옴표가 없습니다. – Barmar

+0

여기에서 확장 ASCII 코드를 참조하십시오. http://www.asciitable.com/ – Barmar

답변

0

이을의 문자를 찾을 수없는 것 같다 어떤 문제를 해결하는 데 도움이 될 수 있습니다.

<?php 
/* to avoid diamond shaped/garbled character output in browser 
make the browser uses the correct encoding. Use a header. 
*/ 
header("Content-Type: text/html; charset=ISO-8859-1"); 
$chr = chr(147); 
echo 'replacing ' . $chr . ' in target string.' . '<br />'; 
$txt = 'sometext' . $chr . 'andthensomemore' . $chr . 'andterminate'; 
echo 'BEFORE : ' . $txt . '<br />'; 
$txt = str_replace($chr, '"', $txt); 
echo 'AFTER : ' . $txt; 
?>