看板 PHP 關於我們 聯絡資訊
在程式裡用pdftotext的方式將PDF檔轉成UTF-8的txt文字檔 接著抓出txt裡面的一段文字 $_str = '生日:066年11月28日'; $_str = str_replace("生日:", '', $_str); $_str = str_replace("年" , '', $_str); $_str = str_replace("月" , '', $_str); $_str = str_replace("日" , '', $_str); echo $_str; Output:066年1128 我手動複製沒被替換過去的「年」做替換,發現可行, google到是字元代碼不相同的問題,這個狀況第一次遇到, 想問一下版上大家有哪些經驗,想伸個關鍵字,謝謝。 -- ╭────────╮ │請問您為什麼 │ ╭───╮ │下定決心拋棄微軟 > εˋρ ξ 3 < 我窮。│ │擁抱自由軟體呢?│ ﹀∕  ̄﹀M ╰───╯ ╰────────╯ 》 ║ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.217.117.113 ※ 文章網址: http://www.ptt.cc/bbs/PHP/M.1404087345.A.BCD.html
joedenkidd:要不要在做replace前,將string再轉一次utf8看看 06/30 22:54
joedenkidd:用iconv轉,看這樣有沒有機會解決 06/30 22:55