dousheyan0375 2014-07-03 02:52
浏览 7

我需要特殊字符的帮助到我的phpmyadmin

Am try to insert strings containing special characters like single quote and double quote (',") but it's refusing to insert or even when it does and I want to display it in HTML it shows codes instead the character I typed.

For instance I have a form when i type things with single quotation mark like this These are an example's of them because of the single quote it does not insert it into myphpadmin and if I display them it shows characters like this 
&#13 please someone should me correct these two mistakes

  • 写回答

1条回答 默认 最新

  • dongzinen1061 2014-07-03 02:59
    关注

    Is this pasted content from MS word? It may be that they are the smart quotes or curly quotes instead of the normal quotes If so I use this function to clean them

    ( normal quotes are ' single " double ).
    
    function convert_smart_quotes($text){
            $search = array(
                "\xe2\x80\x98", // "'"
                "\xe2\x80\x99", // "'"
                "\xe2\x80\x9c", // '"'
                "\xe2\x80\x9d", // '"'
                "\xe2\x80\x93", // '-'
                "\xe2\x80\x94", // '-'
                "\xe2\x80\xa6", // '...'
                chr(145),
                chr(146),
                chr(147),
                chr(148),
                chr(150),
                chr(151),
                chr(133)    
            );
    
            $replace = array(
                "'",
                "'",
                '"',
                '"',
                '-',
                '-',
                '...',
                "'",
                "'",
                '"',
                '"',
                '-',
                '-',
                '...'
            );
    
            $text = str_replace($search, $replace, $text);
    
            return $text;
        }
    

    p.s. the OP would most likely have a syntax error in his query if they where normal quotes and not escaped properly.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度