encoding

Encoding problems when writing to the console in node.js

此生再无相见时 提交于 2019-12-25 11:06:12
问题 I'm having problems with the encoding in node.js. I'm running it on windows and for example if I run this simple program: console.log("trying áéíóú"); I get in the console: trying ????? Is this normal? How can I solve this problem? Thanks 回答1: The problem is that your console is not capable of handling certain characters the way it is currently configured. Check in the settings and see if you can enable different character sets. You probably want to use Unicode. 来源: https://stackoverflow.com

Decoding UTF-8 String, then encoding it in 8859-2 for Slovakian alphabet

纵然是瞬间 提交于 2019-12-25 10:34:34
问题 I'm trying to translate strings into Slovakian alphabet (8859-2 encoding) via a matching table I created. Problem is some characters do not actually change and the output string shows me "?" for some slovakian character. How do I do that? I did something like this first : File tempFile = File.createTempFile("buffer", ".tmp"); FileWriter fw = new FileWriter(tempFile); Reader fr = new FileReader(fileOriginal); BufferedReader br = new BufferedReader(fr); while (br.ready()) { fw.write(br.readLine

Decoding UTF-8 String, then encoding it in 8859-2 for Slovakian alphabet

妖精的绣舞 提交于 2019-12-25 10:34:16
问题 I'm trying to translate strings into Slovakian alphabet (8859-2 encoding) via a matching table I created. Problem is some characters do not actually change and the output string shows me "?" for some slovakian character. How do I do that? I did something like this first : File tempFile = File.createTempFile("buffer", ".tmp"); FileWriter fw = new FileWriter(tempFile); Reader fr = new FileReader(fileOriginal); BufferedReader br = new BufferedReader(fr); while (br.ready()) { fw.write(br.readLine

Regular String to IDNA in Java

南笙酒味 提交于 2019-12-25 09:55:14
问题 Is there a library that is able to parse Unicode domain name into IDNA? Like שלום.com ==> http://xn--9dbne9b.com/ ? 回答1: java.net.IDN seems to do the trick. From my Scala console: scala> java.net.IDN.toUnicode("xn--9dbne9b.com") res0: java.lang.String = שלום.com Note that it works on the hostname, not the URL. So you'll have to strip/extract the http:// protocol first. A quick glance at the documentation reveals it works in the opposite direction too. From above (my Unicode hostname in the

JAVA Transformer adding spaces and single quotes to XML header and not encoding the resulting XML file?

女生的网名这么多〃 提交于 2019-12-25 09:29:18
问题 I have the following JAXB marshaller that is using a DOM result in order to add XML Digital Signature later on: JAXBContext jaxbContext = JAXBContext.newInstance(DataPDU.class); DataPDU myDataPDU = new DataPDU(); myDataPDU.setRevision("2.0.6"); // marshall the file Marshaller marshaller = jaxbContext.createMarshaller(); DOMResult domResult = new DOMResult(); marshaller.marshal(myDataPDU, domResult); // get the document list Document document = (Document) domResult.getNode(); // create the

Xmlstarlet ed encoding and powershell inside Process C#

扶醉桌前 提交于 2019-12-25 08:48:24
问题 I want to use xmlstarlet from the powershell started with Process in a C# application. My main problem is that when I use this code: ./xml.exe ed -N ns=http://www.w3.org/2006/04/ttaf1 -d '//ns:div[not(contains(@xml:lang,''Italian''))]' "C:\Users\1H144708H\Downloads\a.mul.ttml" > "C:\Users\1H144708H\Downloads\a.mul.ttml.conv" on powershell I get a file with the wrong encoding (I need UTF-8). On Bash I used to just export LANG=it_IT.UTF-8 && before xmlstarlet but on powershell I really don't

c# how to output Unicode characters?

夙愿已清 提交于 2019-12-25 08:47:49
问题 I have int values stored in a list, that I want to output as unicode characters, like this: //A List<int> named Kanji exists and has values Console.OutputEncoding = Encoding.Unicode; int i = 0; while (i < Kanji.Count) { Console.WriteLine((char)Kanji[i]); i++; } But this only returns ? characters. What should I do? The int values themselves are fine, I tested them. 回答1: The console is probably not using a Unicode or Japanese encoding, and/or the font used does not contain the required

Memory Increase while Retriving data from database for loading image

坚强是说给别人听的谎言 提交于 2019-12-25 08:28:22
问题 I am working on application in which I store data of image into database like NSString *query = [NSString stringWithFormat:@"INSERT INTO Friends_user (f_id,f_name,f_image,f_mobile) VALUES('%ld','%@','%@','%@')",(long)id_, self.txt_name.text,[UIImagePNGRepresentation(self.img_userprofile.image) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength], self.txt_mobile_no.text ]; It stores Successfully but when I retrieve that data to display image, Memory Increases with every

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

AES-256 CBC encryption succeeds in Ruby/PHP, but decryption fails with CryptoJS

≯℡__Kan透↙ 提交于 2019-12-25 07:59:40
问题 I can AES-256 CBC encrypt a string in PHP or Ruby (using the gem symmetric-encryption) and get the same result. <?php openssl_encrypt( 'Hello!', 'aes-256-cbc', '1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF', 0, '1234567890ABCDEF1234567890ABCDEF' ); // => 'BAd5fmmMTvRE4Ohvf3GpCw==' ruby_cipher = SymmetricEncryption::Cipher.new(key: "1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF", iv: "1234567890ABCDEF1234567890ABCDEF", cipher_name: 'aes-256-cbc') ruby