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

    • <bdo id='doQBy'></bdo><ul id='doQBy'></ul>
      <legend id='doQBy'><style id='doQBy'><dir id='doQBy'><q id='doQBy'></q></dir></style></legend>
    1. <small id='doQBy'></small><noframes id='doQBy'>

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

        為什么這會出現在我的 c# 字符串中:

        Why is this appearing in my c# strings: #194;#163;(為什么這會出現在我的 c# 字符串中:)
        <legend id='RaQrf'><style id='RaQrf'><dir id='RaQrf'><q id='RaQrf'></q></dir></style></legend>

              <bdo id='RaQrf'></bdo><ul id='RaQrf'></ul>
            • <small id='RaQrf'></small><noframes id='RaQrf'>

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

                  本文介紹了為什么這會出現在我的 c# 字符串中:的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在 c# 中有一個字符串,初始化如下:

                  I have a a string in c# initialised as follows:

                  string strVal = "£2000";
                  

                  但是,每當我寫出這個字符串時,都會寫下以下內容:

                  However whenever I write this string out the following is written:

                  2000 英鎊

                  它不會用美元來做這件事.

                  It does not do this with dollars.

                  我用來寫出值的示例代碼:

                  An example bit of code I am using to write out the value:

                  System.IO.File.AppendAllText(HttpContext.Current.Server.MapPath("/logging.txt"), strVal);
                  

                  我猜這與本地化有關,但如果 c# 字符串只是 unicode,這肯定可以工作嗎?

                  I'm guessing it's something to do with localization but if c# strings are just unicode surely this should just work?

                  澄清:更多信息,Jon Skeet 的回答是正確的,但是當我對字符串進行 URLEncode 時,我也遇到了問題.有沒有辦法防止這種情況發生?

                  CLARIFICATION: Just a bit more info, Jon Skeet's answer is correct, however I also get the issue when I URLEncode the string. Is there a way of preventing this?

                  所以 URL 編碼的字符串如下所示:

                  So the URL encoded string looks like this:

                  %c2%a32000"

                  "%c2%a32000"

                  %c2 = ?%a3 = 英鎊

                  %c2 = ? %a3 = £

                  如果我編碼為 ASCII,£ 輸出為 ?

                  If I encode as ASCII the £ comes out as ?

                  還有什么想法嗎?

                  推薦答案

                  在 HTML 頁面和 HTTP 標頭中使用的 URL 的默認字符集稱為 ISO-8859-1 或 ISO Latin-1.

                  The default character set of URLs when used in HTML pages and in HTTP headers is called ISO-8859-1 or ISO Latin-1.

                  它與 UTF-8 不同,也與 ASCII 不同,但它確實適合每個字符一個字節.0 到 127 的范圍很像 ASCII,0 到 255 的整個范圍與 Unicode 的 0000-00FF 范圍相同.

                  It's not the same as UTF-8, and it's not the same as ASCII, but it does fit into one-byte-per-character. The range 0 to 127 is a lot like ASCII, and the whole range 0 to 255 is the same as the range 0000-00FF of Unicode.

                  因此,您可以通過將每個字符轉換為一個字節來從 C# 字符串生成它,或者您可以使用 Encoding.GetEncoding("iso-8859-1") 獲取一個對象來執行為您轉換.

                  So you can generate it from a C# string by casting each character to a byte, or you can use Encoding.GetEncoding("iso-8859-1") to get an object to do the conversion for you.

                  (在此字符集中,英磅符號為 163.)

                  (In this character set, the UK pound symbol is 163.)

                  背景

                  RFC 規定未編碼的文本必須限于傳統的 7-bit US ASCII 范圍,以及其他任何內容(加上特殊的 URL 分隔符)都必須進行編碼.但它留下了一個問題,即在 8 位范圍的上半部分使用什么字符集,使其依賴于 URL 出現的上下文.

                  The RFC says that unencoded text must be limited to the traditional 7-bit US ASCII range, and anything else (plus the special URL delimiter characters) must be encoded. But it leaves open the question of what character set to use for the upper half of the 8-bit range, making it dependent on the context in which the URL appears.

                  該上下文是由另外兩個標準 HTTP 和 HTML 定義的,它們確實指定了默認字符集,并且它們共同對實現者產生了一種實際上不可抗拒的力量,即假設地址欄包含引用 ISO- 的百分比編碼.8859-1.

                  And that context is defined by two other standards, HTTP and HTML, which do specify the default character set, and which together create a practically irresistable force on implementers to assume that the address bar contains percent-encodings that refer to ISO-8859-1.

                  ISO-8859-1 是通過 HTTP 發送的基于文本的內容的字符集 除非另有說明.因此,當 URL 字符串出現在 HTTP GET 標頭中時,它應該在 ISO-8859-1 中.

                  ISO-8859-1 is the character set of text-based content sent via HTTP except where otherwise specified. So by the time a URL string appears in the HTTP GET header, it ought to be in ISO-8859-1.

                  另一個因素是 HTML 也使用 ISO-8859-1 作為其默認值,并且 URL 通常源自 HTML 頁面中的鏈接.因此,當您在記事本中制作一個簡單的最小 HTML 頁面時,您在該文件中鍵入的 URL 采用 ISO-8859-1 格式.

                  The other factor is that HTML also uses ISO-8859-1 as its default, and URLs typically originate as links in HTML pages. So when you craft a simple minimal HTML page in Notepad, the URLs you type into that file are in ISO-8859-1.

                  它有時被描述為標準中的漏洞",但實際上并非如此;只是 HTML/HTTP 填補了 RFC 為 URL 留下的空白.

                  It's sometimes described as "hole" in the standards, but it's not really; it's just that HTML/HTTP fill in the blank left by the RFC for URLs.

                  因此,例如,此頁面上的建議:

                  字符的 URL 編碼包括一個%"符號,后跟兩位十六進制表示ISO-Latin 的(不區分大小寫)字符的代碼點.

                  URL encoding of a character consists of a "%" symbol, followed by the two-digit hexadecimal representation (case-insensitive) of the ISO-Latin code point for the character.

                  (ISO-Latin 是 IS-8859-1 的另一個名稱).

                  (ISO-Latin is another name for IS-8859-1).

                  理論就講這么多.將此粘貼到記事本中,將其保存為 .html 文件,然后在幾個瀏覽器中打開它.點擊鏈接,Google 應該會搜索英鎊.

                  So much for the theory. Paste this into notepad, save it as an .html file, and open it in a few browsers. Click the link and Google should search for UK pound.

                  <HTML>
                    <BODY>
                      <A >Test</A>
                    </BODY>
                  </HTML>
                  

                  它適用于 IE、Firefox、Apple Safari、Google Chrome - 我目前沒有其他可用的.

                  It works in IE, Firefox, Apple Safari, Google Chrome - I don't have any others available right now.

                  這篇關于為什么這會出現在我的 c# 字符串中:的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯誤的 XML)
                • <i id='BySTb'><tr id='BySTb'><dt id='BySTb'><q id='BySTb'><span id='BySTb'><b id='BySTb'><form id='BySTb'><ins id='BySTb'></ins><ul id='BySTb'></ul><sub id='BySTb'></sub></form><legend id='BySTb'></legend><bdo id='BySTb'><pre id='BySTb'><center id='BySTb'></center></pre></bdo></b><th id='BySTb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BySTb'><tfoot id='BySTb'></tfoot><dl id='BySTb'><fieldset id='BySTb'></fieldset></dl></div>
                  <legend id='BySTb'><style id='BySTb'><dir id='BySTb'><q id='BySTb'></q></dir></style></legend>

                      <tfoot id='BySTb'></tfoot>
                            <bdo id='BySTb'></bdo><ul id='BySTb'></ul>
                              <tbody id='BySTb'></tbody>

                            <small id='BySTb'></small><noframes id='BySTb'>

                            主站蜘蛛池模板: 国产高清免费 | 国产极品车模吞精高潮呻吟 | 国产二区av| 国产精品一区二区av | 久久一二| 久久精品国产久精国产 | 在线日韩在线 | 国产综合网站 | 九九精品久久久 | 成人1区2区 | 成人免费黄色片 | 久久99精品视频 | aaaaa毛片 | 在线观看国产wwwa级羞羞视频 | 国产97久久| 精品视频久久久 | 国产精品视频免费 | 中日韩av| 天天躁日日躁xxxxaaaa | av在线播放网| 精精国产xxxx视频在线野外 | 亚洲人成人一区二区在线观看 | 日韩一区二区三区精品 | 亚洲五码在线 | 在线伊人网| 超碰97av| 免费一看一级毛片 | 青青草综合| 成人免费视频网站在线观看 | 国产精品1区 | 国产欧美精品一区 | www.99热这里只有精品 | www国产精品 | 久久99精品视频 | 久久男女视频 | 日本在线中文 | 日韩精品免费看 | 亚洲资源在线 | 国产在线97 | 日韩三级在线 | 亚洲国产二区 |