encoding

Encrypting string gives different results

天涯浪子 提交于 2020-03-06 10:58:21
问题 I've been given the task to make two older systems work together. The first is written in ASP Classic and the second in C#. The ASP-C system have generated an encrypted string and stored in the database. Now I need the C# to do the same; providing the str and key should give the same result as the ASP-C. The str: 1234567890 The key: 12$1$doFmp8gD$7Es.78EumklLvtraylRQy034 The ASP-C encryption function: Function EncryptString(str, key) newStr = "" strLen = Len(str) keyLen = Len(key) keyPos = 1

C# FileStream read set encoding

人盡茶涼 提交于 2020-03-05 09:35:10
问题 There might be something obvious I'm missing here, but I can't seem to set the encoding on my FileStream read. Here's the code: FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read); using (fs) { byte[] buffer = new byte[chunk]; fs.Seek(chunk, SeekOrigin.Begin); int bytesRead = fs.Read(buffer, 0, chunk); while (bytesRead > 0) { ProcessChunk(buffer, bytesRead, database, id); bytesRead = fs.Read(buffer, 0, chunk); } } fs.Close(); Where ProcessChunk saves the read values to

How do I load a UTF16-encoded text file in Julia?

徘徊边缘 提交于 2020-03-01 03:31:24
问题 I have a text file I am (pretty sure) is encoded in UTF16, but I don't know how to load it in Julia. Do I have to load it as bytes and then convert with UTF16String ? 回答1: The simplest way is to read it as bytes and then convert: s = open(filename, "r") do f utf16(readbytes(f)) end Note that utf16 also checks for a byte-order-mark (BOM), so it will deal with endianness issues and won't include the BOM in the resulting s . If you really want to avoid making a copy of the data, and you know it

Why do popular Java Base64 encoding libraries use OutputStreams for Encoding and InputStreams for encoding?

 ̄綄美尐妖づ 提交于 2020-02-24 16:07:13
问题 I have been trying to solve a memory issue in a Java program where we are loading an entire file into memory, base64 encoding it and then using it as a form parameter in a post request. This is cause OOME due to the extremely large file size. I am working on a solution where I am able to stream the file through a base64 encoder, into the request body of an Http Post request. One of the common patterns I have noticed in all of the popular encoding libraries( Guava, java.util.Base64, android

www.paypal.com/jp/cgi-bin/webscr? item_name encoding

∥☆過路亽.° 提交于 2020-02-24 05:38:52
问题 I am working on a site that is trying pass a japanese item name to paypal through this form <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input name="cmd" value="_xclick" type="hidden"> <input name="item_name" value="フォトグラフィー基礎コース" type="hidden"> <input name="amount" value="59000" type="hidden"> <input name="currency_code" value="JPY" type="hidden"> <input type="hidden" name="item_number" value="PHP001"> <input name="no_note" value="0" type="hidden">

Gmail API not respecting UTF encoding in subject

二次信任 提交于 2020-02-23 12:24:37
问题 In an app I'm helping develop we've added in the ability for a user to invite other users and personalize the invitation email, and then send it via Gmail's APIs. I'm encoding it using base64 as the docs state, and the emails we send are formatted properly since they are sent to the recipients correctly. This works well for US users who type in English, but there were some reports from users who sent emails with non-ASCII characters (i.e. in Hebrew) having their emails garbled when sent. I

Python email payload decoding

萝らか妹 提交于 2020-02-22 08:10:35
问题 I know this question has been asked thousand of time, but I am near to a nervous break so I can't help but to ask for help. I have an email with french accents caractères. The sentence is : "céline : Berlin Annette : 0633'. The email package of python changes ':' on '=3A' "é" on "=E9". How to get back to the accent ?? and to the "=" sign ? I tried several things looking through the net : getting the payload : >>> z = msg.get_payload() >>> z 'C=E9line =3A Berlin Annette =3A 0633' >>> infos(z)

Python email payload decoding

淺唱寂寞╮ 提交于 2020-02-22 08:08:54
问题 I know this question has been asked thousand of time, but I am near to a nervous break so I can't help but to ask for help. I have an email with french accents caractères. The sentence is : "céline : Berlin Annette : 0633'. The email package of python changes ':' on '=3A' "é" on "=E9". How to get back to the accent ?? and to the "=" sign ? I tried several things looking through the net : getting the payload : >>> z = msg.get_payload() >>> z 'C=E9line =3A Berlin Annette =3A 0633' >>> infos(z)

Python email payload decoding

人走茶凉 提交于 2020-02-22 08:06:33
问题 I know this question has been asked thousand of time, but I am near to a nervous break so I can't help but to ask for help. I have an email with french accents caractères. The sentence is : "céline : Berlin Annette : 0633'. The email package of python changes ':' on '=3A' "é" on "=E9". How to get back to the accent ?? and to the "=" sign ? I tried several things looking through the net : getting the payload : >>> z = msg.get_payload() >>> z 'C=E9line =3A Berlin Annette =3A 0633' >>> infos(z)

Java file encoding conversion from ANSI to UTF8

孤街浪徒 提交于 2020-02-22 05:27:27
问题 I have a requirement to change the encoding of a file from ANSI(windows-1252) to UTF8. I wrote below program to do it through java. This program converts the characters to UTF8, but when I opened the file in notepad++ the encoding type was displayed as ANSI as UTF8. This gives me error when I import this file in access db. A file with UTF8 encoding only is desired. Also the requirement is to convert the file without opening it in any editor. public class ConvertFromAnsiToUtf8 { private static