久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='ybcbi'><style id='ybcbi'><dir id='ybcbi'><q id='ybcbi'></q></dir></style></legend>

    <tfoot id='ybcbi'></tfoot>
      <bdo id='ybcbi'></bdo><ul id='ybcbi'></ul>
    1. <small id='ybcbi'></small><noframes id='ybcbi'>

    2. <i id='ybcbi'><tr id='ybcbi'><dt id='ybcbi'><q id='ybcbi'><span id='ybcbi'><b id='ybcbi'><form id='ybcbi'><ins id='ybcbi'></ins><ul id='ybcbi'></ul><sub id='ybcbi'></sub></form><legend id='ybcbi'></legend><bdo id='ybcbi'><pre id='ybcbi'><center id='ybcbi'></center></pre></bdo></b><th id='ybcbi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ybcbi'><tfoot id='ybcbi'></tfoot><dl id='ybcbi'><fieldset id='ybcbi'></fieldset></dl></div>

      PHP:在不知道原始字符集的情況下將任何字符串轉

      PHP: Convert any string to UTF-8 without knowing the original character set, or at least try(PHP:在不知道原始字符集的情況下將任何字符串轉換為 UTF-8,或者至少嘗試)
    3. <tfoot id='RL2hx'></tfoot>
        <bdo id='RL2hx'></bdo><ul id='RL2hx'></ul>

          <tbody id='RL2hx'></tbody>

        1. <small id='RL2hx'></small><noframes id='RL2hx'>

          <legend id='RL2hx'><style id='RL2hx'><dir id='RL2hx'><q id='RL2hx'></q></dir></style></legend>

          • <i id='RL2hx'><tr id='RL2hx'><dt id='RL2hx'><q id='RL2hx'><span id='RL2hx'><b id='RL2hx'><form id='RL2hx'><ins id='RL2hx'></ins><ul id='RL2hx'></ul><sub id='RL2hx'></sub></form><legend id='RL2hx'></legend><bdo id='RL2hx'><pre id='RL2hx'><center id='RL2hx'></center></pre></bdo></b><th id='RL2hx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='RL2hx'><tfoot id='RL2hx'></tfoot><dl id='RL2hx'><fieldset id='RL2hx'></fieldset></dl></div>
                本文介紹了PHP:在不知道原始字符集的情況下將任何字符串轉換為 UTF-8,或者至少嘗試的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我有一個與來自世界各地的客戶打交道的應用程序,當然,我希望進入我的數據庫的所有內容都采用 UTF-8 編碼.

                I have an application that deals with clients from all over the world, and, naturally, I want everything going into my databases to be UTF-8 encoded.

                對我來說的主要問題是我不知道任何字符串的來源將是什么編碼 - 它可能來自文本框(使用 <form accept-charset="utf-8"> 只有在用戶實際提交表單時才有用),或者它可能來自上傳的文本文件,所以我真的無法控制輸入.

                The main problem for me is that I don't know what encoding the source of any string is going to be - it could be from a text box (using <form accept-charset="utf-8"> is only useful if the user is actually submitted the form), or it could be from an uploaded text file, so I really have no control over the input.

                我需要的是一個函數或類,以確保進入我的數據庫的內容盡可能采用 UTF-8 編碼.我試過 iconv(mb_detect_encoding($text), "UTF-8", $text);但這有問題(如果輸入是未婚夫",則返回未婚夫").我已經嘗試了很多東西 =/

                What I need is a function or class that makes sure the stuff going into my database is, as far as is possible, UTF-8 encoded. I've tried iconv(mb_detect_encoding($text), "UTF-8", $text); but that has problems (if the input is 'fiancée' it returns 'fianc'). I've tried a lot of things =/

                對于文件上傳,我喜歡要求最終用戶指定他們使用的編碼,并向他們展示輸出的預覽,但這無助于抵御討厭的黑客(事實上,它可以讓他們的生活更輕松).

                For file uploads, I like the idea of asking the end user to specify the encoding they use, and show them previews of what the output will look like, but this doesn't help against nasty hackers (in fact, it could make their life a little easier).

                我已經閱讀了有關該主題的其他 SO 問題,但它們似乎都有細微的差異,例如我需要解析 RSS 提要"或我從網站上抓取數據"(或者,實際上,您不能").

                I've read the other SO questions on the subject, but they seem to all have subtle differences like "I need to parse RSS feeds" or "I scrape data from websites" (or, indeed, "You can't").

                但必須有一些東西至少有一個很好的嘗試

                But there must be something that at least has a good try!

                推薦答案

                您的要求非常困難.如果可能,最好讓用戶指定編碼.以這種方式防止攻擊不應該更容易或更難.

                What you're asking for is extremely hard. If possible, getting the user to specify the encoding is the best. Preventing an attack shouldn't be much easier or harder that way.

                但是,您可以嘗試這樣做:

                However, you could try doing this:

                iconv(mb_detect_encoding($text, mb_detect_order(), true), "UTF-8", $text);
                

                將其設置為嚴格可能會幫助您獲得更好的結果.

                Setting it to strict might help you get a better result.

                這篇關于PHP:在不知道原始字符集的情況下將任何字符串轉換為 UTF-8,或者至少嘗試的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

                    • <small id='kPyH4'></small><noframes id='kPyH4'>

                        <legend id='kPyH4'><style id='kPyH4'><dir id='kPyH4'><q id='kPyH4'></q></dir></style></legend>

                        <i id='kPyH4'><tr id='kPyH4'><dt id='kPyH4'><q id='kPyH4'><span id='kPyH4'><b id='kPyH4'><form id='kPyH4'><ins id='kPyH4'></ins><ul id='kPyH4'></ul><sub id='kPyH4'></sub></form><legend id='kPyH4'></legend><bdo id='kPyH4'><pre id='kPyH4'><center id='kPyH4'></center></pre></bdo></b><th id='kPyH4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kPyH4'><tfoot id='kPyH4'></tfoot><dl id='kPyH4'><fieldset id='kPyH4'></fieldset></dl></div>
                          <tbody id='kPyH4'></tbody>
                        <tfoot id='kPyH4'></tfoot>

                          <bdo id='kPyH4'></bdo><ul id='kPyH4'></ul>
                          主站蜘蛛池模板: 久久国内精品 | 一区二区电影网 | www.天天操.com | 中文字幕一二三区 | 色视频在线播放 | 欧美精品在线播放 | 国产永久免费 | 久久精品国产久精国产 | 精品欧美黑人一区二区三区 | www精品美女久久久tv | 日本精品一区二区三区在线观看 | 日韩在线播放第一页 | 中文字幕在线二区 | 久一精品| 欧美日韩专区 | 久久久精品视频一区二区三区 | 国产精品国产a | 美女露尿口视频 | 少妇诱惑av| 国产精品国产三级国产a | 另类 综合 日韩 欧美 亚洲 | 精品视频一区二区三区在线观看 | 黄色在线免费看 | 激情小说综合网 | 国产精品久久精品 | 你懂的国产 | 中文精品久久 | 一区二区国产在线 | 国产精品一区二区久久精品爱微奶 | 午夜影院普通用户体验区 | 亚洲国产福利视频 | 国产精品久久久久久妇女6080 | www.日韩欧美 | 最近中文字幕第一页 | 91私密视频 | 欧美激情综合 | 亚洲成人国产综合 | 91大神在线资源观看无广告 | 日韩看片 | 日韩av中文 | 99热欧美|