problem about decoding-Collection of common programming errors


  • BeowulfOF
    python parsing unicode encoding decoding
    I’m trying to parse through a bunch of logfiles (up to 4GiB) in a tar.gz file. The source files come from RedHat 5.8 Server systems and SunOS 5.10, processing has to be done on WindowsXP.I iterate through the tar.gz files, read the files, decode the file contents to UTF-8 and parse them with regular expressions before further processing.When I’m writing out the processed data along with the raw-data that was read from the tar.gz, I get the following error:Traceback (most recent call last):File “C:\WoMMaxX\lt_automation\Tools\LogParser.py”, line 375, in p.analyze_longtails()File “C:\WoMMaxX\lt_automation\Tools\LogParser.py”, line 196, in analyze_longtailsoFile.write(entries[k

  • frank
    python list-comprehension decoding
    I am using Python 2.6 on Linux. I have a shift_jis (Japanese) encoded .csv file that I am loading. I am reading the header in, and doing a regex replacement to translate a few values, then writing the file back as shift_jis. I am hitting a UnicodeDecodeError on one of the characters in the file, ①, which should be a valid character according to http://www.rikai.com/library/kanjitables/kanji_codes.sjis.shtml. The other Japanese characters decode fine. 1) I am decoding the string using shift_jis in a list comprehension. What can I do if I want to just ignore (workaround) this and other bad characters

  • Farrukh Arshad
    node.js download base64 jpeg decoding
    In my node.js server I am downloading a file from another server. The downloaded file is a JPG image data encoded with Base64 two times, that means I have to decode it 2 times. Given is my code.var base64DecodedFileData = new Buffer(file_data, ‘base64’).toString(‘binary’); var tmp = base64DecodedFileData.split(“b

  • sarnold

  • Lundin
    c sockets encoding embedded decoding
    I have an embedded device which sends me UTC date in this format (date is 4 bytes):buffer.push_back((BYTE)(time_utc & 0x000000FF));buffer.push_back((BYTE)((time_utc & 0x0000FF00) >> 8));buffer.push_b

  • Bujanca Mihai
    php json json-decode decoding

Originally posted 2013-11-09 23:32:17.