MAC Textedit到PHP编码显示有线字符

时间:2016-09-08 12:24:46

标签: php regex macos encoding

 , â€, ™s,  , â€, ™s,  , â€, ™s,  , â€, ™s

我使用下面的代码进行转换连字符符号,但上面和其他字符不会从mac文本显示到HTML输出,有时会生成有线字符,如$content = "Hypertension, Stage 1 - Systolic 140Ð159 or diastolic 90Ð99"; $content = iconv(mb_detect_encoding($content, mb_detect_order(), true), "UTF-8//TRANSLIT//IGNORE", $content); $encoding = mb_detect_encoding( $content, "auto" ); $content = str_replace( "?", "[question_mark]", $content ); $content = mb_convert_encoding( $content, $target_encoding, $encoding); $content = str_replace( "?", "", $content ); $content = str_replace( "[question_mark]", "?", $content ); echo $content;

$content = "Hypertension, Stage 1 - Systolic 140Ð159 or diastolic 90Ð99";
$content = html_entity_decode($content, ENT_COMPAT, 'UTF-8');
preg_match_all('/[^\x20-\x7f][^!-]/', $content, $badwords);
print_r($badwords[0]);

此后无法进行转换我尝试使用此代码手动更改有线字符,代码下方也找不到有线字符,有时也无法读取非有线字符。

import org.json.JSONObject
import org.json.JSONTokener
import org.json.XML

def convertJsonToXml(String json) {
    def o = new JSONTokener(json).nextValue()
    return XML.toString(o)
}

0 个答案:

没有答案