encoding

Google AppEngine - How to set default Charset / file-encoding (to UTF-8) for Google AppEngine

南笙酒味 提交于 2019-12-24 00:57:09
问题 Situation I'm using AppEngine Cloud Endpoints (Java) as backendserver for my Android-application. In a Cron-Job the server regularly downloads new data (String), filters out relevant information and sends it via Firebase Cloud Messaging to different topics (by posting HTTP-Request to https://fcm.googleapis.com/fcm/send). The (damn simple) Problem The downloaded text is in German, containing letters like ä,ö,ü,ß and (to not have the famous ?s istead of these characters) I want to change the

UTF-8 to UTF-16LE Javascript

旧巷老猫 提交于 2019-12-24 00:55:42
问题 I need to convert an utf-8 string to utf-16LE in javascript like the iconv() php function. Ie: iconv("UTF-8", "UTF-16LE", $string); The output should be like this: 49 00 6e 00 64 00 65 00 78 00 I found this func to decode UTF-16LE and it's works fine but i don't know how to do the same to encode. function decodeUTF16LE( binaryStr ) { var cp = []; for( var i = 0; i < binaryStr.length; i+=2) { cp.push( binaryStr.charCodeAt(i) | ( binaryStr.charCodeAt(i+1) << 8 ) ); } return String.fromCharCode

Base 64 encoding in C#

泪湿孤枕 提交于 2019-12-24 00:24:42
问题 I have inherited some C# code. This code needs to upload a picture to a web service. This code saves the bytes of picture into byte[] called ImageBytes . To ensure the greatest portability, I want to first encode the ImageBytes into a base 64 encoded string. I believe the following code is doing that, however, I'm not sure. Can someone please verify if my assumption is correct? StringBuilder sb = new StringBuilder(); this.ImageBytes.ToList<byte>().ForEach(x => sb.AppendFormat("{0}.", Convert

Firebase Database - Wrong Encoding

戏子无情 提交于 2019-12-24 00:19:01
问题 I am new to Firebase and I want to use their Database, but there seems to be some issues with the encoding. Here is my example json with UTF-8 Encoding: [ { "Stack": "This is madness! äüöß ", "Overflow": 666 } ] And this is the result, when I import the json to Firebase: What can I do to import characters like "äüöß" to the Firebase Database? Thank you! 回答1: thank you for your answers. I used the Web Console to import the json (https://console.firebase.google.com/project/[projectname]

How to pass encrypted data via browser (HTML5) session variable

£可爱£侵袭症+ 提交于 2019-12-24 00:07:20
问题 I am trying to pass encrypted data via a browser/client session variable - not to be confused with server-side session variable : encrypt: var encrypted_user_id = CryptoJS.AES.encrypt(user_id, cipher_pass); var encrypted_user_password = CryptoJS.AES.encrypt(password, cipher_pass); sessionStorage.setItem('user_id', encrypted_user_id); sessionStorage.setItem('user_password', encrypted_user_password); decrypt: var encrypted_user_id = sessionStorage.getItem('user_id'); var encrypted_user_password

C# Save a file with Korean encoding

不想你离开。 提交于 2019-12-24 00:02:15
问题 Have the following codeblock that saves a file with the selected encoding. When the file is opened in a text editor it shows the encoding as ASCII.. StringBuilder sb = new StringBuilder(); sb.Append(); // Lots of korean text here Encoding enc = Encoding.GetEncoding(51949); using (StreamWriter sw = new StreamWriter(fileName, false, enc)) { sw.Write(sb.ToString()); sw.Flush(); sw.Close(); } Can anyone help? Thanks 回答1: You have to use UnicodeEncoding while saving the file, and for unicode

encoding of backslash in pythons pyautogui

蓝咒 提交于 2019-12-23 22:33:27
问题 I am trying write a python script that runs an external program automatically by clicking buttons and give keyboard input (usually file paths) with pyautogui. Now if I try use the funktion pyautogui.typewriter(filepath) it always types the backslashes as questionmarks. This minimal example: pyautogui.typewrite('\\') returns simply ? Now, if I change my keyboard layout in the system settings to english, it correctly returns \ My default layout is german, and I cant really change that because

Python parsing JSON with escaped double quotes

a 夏天 提交于 2019-12-23 22:27:23
问题 Consider this valid json: {"a": 1, "b": "{\"c\":2}"} Python's json module throws when I try to parse it - it looks like the \" is throwing it off: json.loads('{"a": 1, "b": "{\"c\":2}"}') Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365,

dompdf special character showing question mark?

流过昼夜 提交于 2019-12-23 22:03:26
问题 I have used dompdf 0.5.1 for generating PDF files. But the special characters are not properly showing. For example, . It is showing something like – “ in the generated PDF file. I used UTF-8 encoding like <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the HTML page which is rendered by the dompdf. I also have used the encoding before sending it to dompdf, like $dompdf->load_html(utf8_decode($html)); . But I get ? marks instead of the above characters. How do I

java - generate unicode pdf with Apache PDFBox

▼魔方 西西 提交于 2019-12-23 20:56:21
问题 I have to generate pdf in my spring mvc application. recently I tested iTextPdf library, but i could not generate unicode pdf document. in fact I didn't see non-latin characters in the generated document. I decided to use Apache PDFBox for my purpose, but I don't know has it support unicode characters? If has, is there any good tutorial for learning pdfBox? And If not, which library should I use? Thanks in advance. 回答1: The 1.8.* versions don't support PDF generation with Unicode, but the 2.0