Converting Microsoft Word special characters with PHP

前端 未结 4 552
忘了有多久
忘了有多久 2020-12-24 08:01

I am trying to convert Word text pasted by users that contain MS Word ellipsis and long dash before processing it further.

I found an old proposed solution here to t

4条回答
  •  無奈伤痛
    2020-12-24 08:20

    Great solution. I copied and pasted it and it worked with out a problem. On further study, I added a few characters that were not in the search and replace array. In order to find the ASCII character id numbers, I wrote a PHP function which shows what the ASCII character number is:

    function stdump($s){
    
      for($i=0;$i";
    }
    

    The character is display and next to it the ascii number is show in parenthesis. Like this:

    echo stdump("GPUs…");

    produces:

    G(71)P(80)U(85)s(115)â(226)€(128)¦(166)

    Hope this helps.

    --Keith

提交回复
热议问题