utf

Android WebView with garbled UTF-8 characters.

和自甴很熟 提交于 2019-11-26 18:26:44
I'm using some webviews in my android app, but are unable to make them display in utf-8 encoding. If use this one I won't see my scandinavian charcters: mWebView.loadUrl("file:///android_asset/om.html") And if try this one, I won't get anything displayed at all mWebView.loadDataWithBaseURL("file:///android_asset/om.html", null, "text/html", "utf-8",null); Regards Eric Nordvik You can try to edit the settings of your webview before you load the data: WebSettings settings = mWebView.getSettings(); settings.setDefaultTextEncodingName("utf-8"); Also, as provided in the comment below, be sure to

Do UTF-8, UTF-16, and UTF-32 differ in the number of characters they can store?

雨燕双飞 提交于 2019-11-26 15:43:29
问题 Okay. I know this looks like the typical "Why didn't he just Google it or go to www.unicode.org and look it up?" question, but for such a simple question the answer still eludes me after checking both sources. I am pretty sure that all three of these encoding systems support all of the Unicode characters, but I need to confirm it before I make that claim in a presentation. Bonus question: Do these encodings differ in the number of characters they can be extended to support? 回答1: No, they're

Which encoding opens CSV files correctly with Excel on both Mac and Windows?

混江龙づ霸主 提交于 2019-11-26 15:41:20
We have a web app that exports CSV files containing foreign characters with UTF-8, no BOM. Both Windows and Mac users get garbage characters in Excel. I tried converting to UTF-8 with BOM; Excel/Win is fine with it, Excel/Mac shows gibberish. I'm using Excel 2003/Win, Excel 2011/Mac. Here's all the encodings I tried: Encoding BOM Win Mac -------- --- ---------------------------- ------------ utf-8 -- scrambled scrambled utf-8 BOM WORKS scrambled utf-16 -- file not recognized file not recognized utf-16 BOM file not recognized Chinese gibberish utf-16LE -- file not recognized file not recognized

is PHP str_word_count() multibyte safe?

时光毁灭记忆、已成空白 提交于 2019-11-26 12:46:13
问题 I want to use str_word_count() on a UTF-8 string. Is this safe in PHP? It seems to me that it should be (especially considering that there is no mb_str_word_count() ). But on php.net there are a lot of people muddying the water by presenting their own \'multibyte compatible\' versions of the function. So I guess I want to know... Given that str_word_count simply counts all character sequences in delimited by \" \" (space), it should be safe on multibyte strings, even though its not

UTF-8, UTF-16, and UTF-32

狂风中的少年 提交于 2019-11-26 10:58:16
What are the differences between UTF-8, UTF-16, and UTF-32? I understand that they will all store Unicode, and that each uses a different number of bytes to represent a character. Is there an advantage to choosing one over the other? AnthonyWJones UTF-8 has an advantage in the case where ASCII characters represent the majority of characters in a block of text, because UTF-8 encodes all characters into 8 bits (like ASCII). It is also advantageous in that a UTF-8 file containing only ASCII characters has the same encoding as an ASCII file. UTF-16 is better where ASCII is not predominant, since

Difference between UTF-8 and UTF-16?

谁说我不能喝 提交于 2019-11-26 08:42:58
问题 Difference between UTF-8 and UTF-16? Why do we need these? MessageDigest md = MessageDigest.getInstance(\"SHA-256\"); String text = \"This is some text\"; md.update(text.getBytes(\"UTF-8\")); // Change this to \"UTF-16\" if needed byte[] digest = md.digest(); 回答1: I believe there are a lot of good articles about this around the Web, but here is a short summary. Both UTF-8 and UTF-16 are variable length encodings. However, in UTF-8 a character may occupy a minimum of 8 bits, while in UTF-16

How many characters can be mapped with Unicode?

会有一股神秘感。 提交于 2019-11-26 06:36:25
问题 I am asking for the count of all the possible valid combinations in Unicode with explanation. I know a char can be encoded as 1,2,3 or 4 bytes. I also don\'t understand why continuation bytes have restrictions even though starting byte of that char clears how long it should be. 回答1: I am asking for the count of all the possible valid combinations in Unicode with explanation. 1,111,998 : 17 planes × 65,536 characters per plane - 2048 surrogates - 66 noncharacters Note that UTF-8 and UTF-32

Android WebView with garbled UTF-8 characters.

拥有回忆 提交于 2019-11-26 06:18:06
问题 I\'m using some webviews in my android app, but are unable to make them display in utf-8 encoding. If use this one I won\'t see my scandinavian charcters: mWebView.loadUrl(\"file:///android_asset/om.html\") And if try this one, I won\'t get anything displayed at all mWebView.loadDataWithBaseURL(\"file:///android_asset/om.html\", null, \"text/html\", \"utf-8\",null); Regards 回答1: You can try to edit the settings of your webview before you load the data: WebSettings settings = mWebView

Which encoding opens CSV files correctly with Excel on both Mac and Windows?

Deadly 提交于 2019-11-26 04:34:01
问题 We have a web app that exports CSV files containing foreign characters with UTF-8, no BOM. Both Windows and Mac users get garbage characters in Excel. I tried converting to UTF-8 with BOM; Excel/Win is fine with it, Excel/Mac shows gibberish. I\'m using Excel 2003/Win, Excel 2011/Mac. Here\'s all the encodings I tried: Encoding BOM Win Mac -------- --- ---------------------------- ------------ utf-8 -- scrambled scrambled utf-8 BOM WORKS scrambled utf-16 -- file not recognized file not

UTF-8, UTF-16, and UTF-32

无人久伴 提交于 2019-11-26 03:29:07
问题 What are the differences between UTF-8, UTF-16, and UTF-32? I understand that they will all store Unicode, and that each uses a different number of bytes to represent a character. Is there an advantage to choosing one over the other? 回答1: UTF-8 has an advantage in the case where ASCII characters represent the majority of characters in a block of text, because UTF-8 encodes all characters into 8 bits (like ASCII). It is also advantageous in that a UTF-8 file containing only ASCII characters