windows-1252

Android UTF-8 encoding not working?

亡梦爱人 提交于 2020-01-16 18:53:28
问题 I am working with a CSV file right now. In my program i am using an OutputStreamWriter to write data the csv file. OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut, Charset.forName("UTF-8").newEncoder()); I tried printing out the encoding style of this writer and get the following: Log.i(TAG, "BODY ENCODING: " + myOutWriter.getEncoding()); Logcat: BODY ENCODING: UTF-8 But when i try to open the csv file on my desktop it says that the file is in windows-1252 so i cant read æøå

Java 1.6 Windows-1252 encoding fails on 3 characters

三世轮回 提交于 2020-01-14 10:35:46
问题 EDIT: I've been convinced that this question is somewhat non-sensical. Thanks to those who responded. I may post a follow-up question that is more specific. Today I was investing some encoding problems and wrote this unit test to isolate a base repro case: int badCount = 0; for (int i = 1; i < 255; i++) { String str = "Hi " + new String(new char[] { (char) i }); String toLatin1 = new String(str.getBytes("UTF-8"), "latin1"); assertEquals(str, new String(toLatin1.getBytes("latin1"), "UTF-8"));

Converting Unicode to Windows-1252 for vCards

不羁的心 提交于 2019-12-28 23:05:11
问题 I am trying to write a program in C# that will split a vCard (VCF) file with multiple contacts into individual files for each contact. I understand that the vCard needs to be saved as ANSI (1252) for most mobile phones to read them. However, if I open a VCF file using StreamReader and then write it back with StreamWriter (setting 1252 as the Encoding format), all special characters like å , æ and ø are getting written as ? . Surely ANSI (1252) would support these characters. How do I fix this

Encoding from 1252 to Unicode .NET equivalent in java

孤街醉人 提交于 2019-12-25 08:11:27
问题 I have the request to port a .NET web service to java. I need to find the equivalent java code for this piece of code written in .NET: byte[] b = ... // Some file binary data. byte[] encoded = System.Text.Encoding.Convert(System.Text.Encoding.GetEncoding(1252), System.Text.Encoding.Unicode, b); Thanks in advance! 回答1: byte[] b = ... byte[] encoded = new String(b, "Cp1252").getBytes("UTF-16"); 回答2: Have a look on the List of Supported Encoding in java. Cp1252 encoding in java is theequivalent

Wrong charset in ASP classic loaded via AJAX

狂风中的少年 提交于 2019-12-24 06:39:08
问题 I have issue with dynamic loading of part of content on ASP classic page. I use AJAX to load on page dynamically, depending on dropdown selected option. Generated contains some Labels for containing dropdowns and option text inside of dropdowns. Labels are constants encoded in UTF-8 and contain some western European accented characters, and option texts are loaded from database, contain accented characters too but are coded in ANSI. tags are set to utf-8 but it affects only first load of page

C# - Get ANSI code value of a character

北城余情 提交于 2019-12-24 03:47:07
问题 I'd like to retrieve the ANSI code value of a given character. E.g. when I now get the int value of the trademark character, I get 8482. Instead I would like to get 153, which is the value of the trademark character in codepage 1252. Some help would be appreciated. Jurgen 回答1: Found it myself: Encoding ansiEncoding = Encoding.GetEncoding(1252); byte[] bytes = ansiEncoding.GetBytes(c); int code = bytes[0]; 来源: https://stackoverflow.com/questions/12370812/c-sharp-get-ansi-code-value-of-a

Spec justification for &#x80; to &#x9F; in UTF-8 documents browser behaviour wanted

半城伤御伤魂 提交于 2019-12-23 12:59:34
问题 The HTML 4.01 spec says for hexadecimal character references Numeric character references specify the code position of a character in the document character set. So if the document character set encoding is UTF-8, the numeric references should specify a Unicode code point. The HTML5 spec says for hexadecimal character references The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which must be followed by either a U+0078 LATIN SMALL LETTER X character (x) or a U+0058 LATIN

How to convert Windows-1252 characters to values in php?

两盒软妹~` 提交于 2019-12-19 07:21:51
问题 We have several database fields that contain Windows-1252 characters: an example pain— if you’re Those values map to the desired values from this list: http://www.i18nqa.com/debug/utf8-debug.html I've tried various permutations of htmlentites, mb_detect_encoding, uft8_decode, etc, but have not yet been able to transform those values to: an example pain — if you're How can I transform these characters to their listed values in php? 回答1: You can use mb_convert_encoding $str = "an example

Windows-1252 to UTF-8 encoding

筅森魡賤 提交于 2019-12-17 15:23:59
问题 I've copied certain files from a Windows machine to a Linux machine. So all the Windows encoded (windows-1252) files need to be converted to UTF-8. The files which are already in UTF-8 should not be changed. I'm planning to use the recode utility for that. How can I specify that the recode utility should only convert windows-1252 encoded files and not the UTF-8 files? Example usage of recode: recode windows-1252.. myfile.txt This would convert myfile.txt from windows-1252 to UTF-8. Before

Javascript FileReader reads file incorrectly

倖福魔咒の 提交于 2019-12-12 19:23:19
问题 I have a short JavaScript function which will take an uploaded file and display the hex equivalent of it. Comparing the original file and the output in a hex-editor shows that they are partially different but not completely. String.prototype.hexEncode = function(){ var hex, i; var result = ""; for (i = 0; i < this.length; i++) { hex = this.charCodeAt(i).toString(16); result += ("" + hex).slice(-4); } return result } function upload() { var file = document.getElementById("fileToUpload").files