iso-8859-1

NSString to NSData Failing in Encoding

六眼飞鱼酱① 提交于 2019-12-13 03:48:53
问题 I'm trying to use NSXmlParser to parse ISO-8859-1 data. Using Apple's own example for parsing ISO-8859-1, I have the following. // path to xml file NSString *xmlFilePath = [[NSBundle mainBundle] pathForResource:sampleFileName ofType:@"xml"]; // string of xml contents NSString *xmlFileContents = [NSString stringWithContentsOfFile:xmlFilePath encoding:NSUTF8StringEncoding error:nil]; NSLog(@"contents: %@", xmlFileContents); I see that in the console, the contents of the string is accurate.

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

Is UTF-8 the encoding of choice for QR-codes with non ASCII chars by now?

∥☆過路亽.° 提交于 2019-12-12 12:04:20
问题 Google uses UTF-8 it as default for their very popular encoder. From what I can see they don't even add the byte order mark. The problem is that most scanners still seem to use JIS8 (QR 2000) instead of iso-8859 (QR 2005) as default, so it mostly does not work to use iso-8859 for encoding. It seems like utf-8 is the only choice even if it is against the specification. edit: I will go with utf-8 without ECI and without BOM. Against all spec and spirit but works best at the moment. 回答1: The

Java; Trying to convert a String which contains ISO-8859-1 encoding to UTF-8 but file is UTF-8

守給你的承諾、 提交于 2019-12-12 10:08:43
问题 I don't know if this is going to make sense but this is what I make of it. I'm working with Eclipse using UTF-8 encoding for all my files. In one of them I need to convert a String from ISO-8859-1 to UTF-8. However that string is formed within the file itself (doesn't come from input) which is why I believe my String starts out as UTF-8 and the conversion doesn't go the way i expected. The String original content is: ||3.2|2013-01-25T17:24:00|ingreso|PAGO EN UNA SOLA EXHIBICION|6386.21|MXN

how to output degree symbol in C programs with iso_8859-1?

独自空忆成欢 提交于 2019-12-12 09:49:43
问题 I looked up the manual of iso_8859-1 and found the degree symbol: Oct Dec Hex Char Description 260 176 B0 ° DEGREE SIGN Code: int main( int argc, char *argv[]) { char chr = 176; //stores the extended ASCII of a symbol printf("Character with an ascii code of 251: %c \n", chr); return 0; } But it printed out as ? . How could I output a degree symbol in a C programme? Do I need to include some files? 回答1: To use other characters than ASCII, on most platforms you have to switch to a "locale" that

Swift 3 convert String from isoLatin1 to utf8

假如想象 提交于 2019-12-12 06:56:35
问题 I need to convert an ISO-8859-1 (isoLatin1) encoded XML string to UTF-8. I tried some code I found on other questions, but most of them covers converting string to utf8 and vice-versa. I don't have any code, so none will be posted. Sorry, to make it clear, I tried: String(data:isoLatin1EncodedData, encoding: .uf8) is nil String(data:isoLatin1EncodedData, encoding: .isoLatin1) returns the string with the wrong encoding. String(utf8String: isoLatin1EncodedString.cString(using: String.Encoding

Converting Html utf-8 charset to ISO-8859-1 via C#

时光总嘲笑我的痴心妄想 提交于 2019-12-12 04:05:31
问题 I've been struggling to convert a html value of an attribute, without any success. Here is the the HTML i am trying to convert (sure the charset will not be shown here, but, i see it exactly as you see it). <a href="https://sistemas.usp.br/jupiterweb/listarGradeCurricular?codcg=12&codcur=12012&codhab=1&tipo=N" target="_blank">Administração – São Paulo – diurno</a> All right, the VALUE of this htmlnode is "Administração - São Paulo - diurno". I am using HtmlAgilityPack to parse the HtmlPage

Encoding difficulties

不羁岁月 提交于 2019-12-12 03:37:15
问题 I'm having some encoding problems with a code I'm working on. An encrypted string is received which is decoded with ISO-8859-1. This string is then put into a DB which has UTF-8 encoding. When this string is retrieved it's still ISO-8859-1, and there's no problems. The issue is that I also need to be able to retrieve this string as UTF-8, but I haven't been successfull in this. I've tried to convert the string from ISO to UTF-8 when retrieved from the DB using this method: private String

How do I encode binary file data to ISO-8859-1 to attach to the body of an HTTP post message

时光怂恿深爱的人放手 提交于 2019-12-12 01:02:42
问题 I'm trying to convert the full string of bytes from a file opened in binary mode to a string encoded in the ISO-8859-1 character set. My understanding is that by converting to ISO-8859-1 all binary information from the file is retained which is why it is being converted to that format. Is this a valid statement? I'm working in C++ (Visual Studio 2017) building an executable to be used on the Windows platform. I'm not experienced in HTTP programming. I have prototype code written in PowerShell

Cannot convert � to readable string with iconv

假装没事ソ 提交于 2019-12-11 19:09:21
问题 I have a large text file with a iso-8859-1 encoding which I obtain from: file -i file.txt When I cat a file to see the data, there will be a �� instead of a Thai string. At first, I think that I can just use iconv in linux to convert the encoding format to other type which I found iso-8859-11 format that can read Thai string and think that it will work. Something like this: iconv -f iso-8859-1 -t iso-8859-11 file.txt > output.txt But instead, I got this error: iconv: illegal input sequence at