decoding

.NET Convert from string of Hex values into Unicode characters (Support different code pages)

只愿长相守 提交于 2019-12-01 21:51:15
I have a string of Hex values... String hexString = "8A65"; I need to convert this string into their Unicode equivalents. The tricky part is that I need to support different code pages and some code pages have '8A65' = one character whereas other code pages would convert it into two characters. I have no prior knowledge of which code page I will be using until I need to perform the conversion. I've tried all sorts of stuff such as byte[] original = Encoding.Unicode.GetBytes(hexString); byte[] conv= Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(932), orig); char[] chars = Encoding

FFMPEG decoding artifacts between keyframes

北城余情 提交于 2019-12-01 21:46:55
I'm currently experiencing artifacts when decoding video using ffmpegs api. On what I would assume to be intermediate frames, artifacts build slowly only from active movement in the frame. These artifacts build for 50-100 frames until I assume a keyframe resets them. Frames are then decoded correctly and the artifacts proceed to build again. One thing that is bothering me is I have a few video samples that are 30fps(h264) that work correctly, but all of my 60fps videos(h264) experience the problem. I don't currently have enough reputation to post an image, so hopefully this link will work.

How to convert a netty ByteBuf to a String and vice versa

只谈情不闲聊 提交于 2019-12-01 15:56:06
问题 Is there a way to convert a netty ByteBuf to a String and vice versa? public String toString(ByteBuf b){ //return b enconded to a String } public Bytebuf ToByteBuff(String s){ //return s decoded to Bytebuf } 回答1: You can use ByteBuf.toString(Charset) to convert to string. You can use String.getBytes(Charset) and Unpooled.wrappedBuffer(byte[]) to convert to ByteBuf. 回答2: You can create a ByteBuf from a String with Unpooled.copiedBuffer(String, Charset) . 来源: https://stackoverflow.com/questions

Python SHA1 DECODE function

主宰稳场 提交于 2019-12-01 14:48:20
I cant find how to decode string encoded in sha1. I'm suprised that i can't find simple function in python docs or google doing sha1 decoding. I give up. I need help.. SHA1 is a hashing algorithm. Hashing is one-way, which means that you can't recover the input from the output for any non-trivial hash function. A simple example of a one-way hash function would be adding together all the digits of a number. 1234 would hash to 1 + 2 + 3 + 4 = 10 , but so would 4321 , 1900 , 5050 , and many other numbers. Given just the hash value of 10 , you can't tell whether the input was 1234 or 5050 because

C# base64 encoding/decoding with serialization of objects issue

早过忘川 提交于 2019-12-01 07:40:16
I'm using serialization and deserialization in C# for my Project (which is a Class). They are serialized and saved to an XML file. When loading the Project, all goes well. Now I'm trying to encode the serialized Project to Base64 and then save the file, which goes well too. The first line of the file (before encoded!) looks like this: <?xml version="1.0" encoding="utf-8"?> <Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> When I decode the file, there's a ? added in front of the line: ?<?xml version="1.0" encoding="utf-8"?> <Project

Is there a way to decode q-encoded strings in Ruby?

只谈情不闲聊 提交于 2019-12-01 06:52:18
I'm working with mails, and names and subjects sometimes come q-encoded, like this: =?UTF-8?Q?J=2E_Pablo_Fern=C3=A1ndez?= Is there a way to decode them in Ruby? It seems TMail should take care of it, but it's not doing it. ankimal I use this to parse email subjects: You could try the following: str = "=?UTF-8?Q?J=2E_Pablo_Fern=C3=A1ndez?=" if m = /=\?([A-Za-z0-9\-]+)\?(B|Q)\?([!->@-~]+)\?=/i.match(str) case m[2] when "B" # Base64 encoded decoded = Base64.decode64(m[3]) when "Q" # Q encoded decoded = m[3].unpack("M").first.gsub('_',' ') else p "Could not find keyword!!!" end Iconv.conv('utf-8'

php system, python and utf-8

允我心安 提交于 2019-12-01 06:52:07
问题 I have a python program running very well. It connects to several websites and outputs the desired information. Since not all websites are encoded with utf-8, I am requesting the charset from the headers and using unicode(string, encoding) method to decode (I am not sure whether its the appropriate way to do this but it works pretty well). When I run the python program I receive no ??? marks and it works fine. But when I run the program using php's system function, I receive this error:

How can I decode data with Base64 in IPhone

泄露秘密 提交于 2019-12-01 05:47:09
问题 Hi My friend is using Base64 encoding standard in java. I am using IPhone how can I decode the data. and viceversa. There is org.apache.commons.codec.binary.Base64.decodeBase64 in java Thanks Deepak 回答1: TouchCode has http://touchcode.googlecode.com/hg/Support/Common/Base64Transcoder.c (and .h) 回答2: There is also some quite simple code you can use here: http://www.cocoadev.com/index.pl?BaseSixtyFour Another interesting way to do it, using OpenSSL: http://www.dribin.org/dave/blog/archives/2006

C# base64 encoding/decoding with serialization of objects issue

a 夏天 提交于 2019-12-01 05:32:26
问题 I'm using serialization and deserialization in C# for my Project (which is a Class). They are serialized and saved to an XML file. When loading the Project, all goes well. Now I'm trying to encode the serialized Project to Base64 and then save the file, which goes well too. The first line of the file (before encoded!) looks like this: <?xml version="1.0" encoding="utf-8"?> <Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> When I

Is there a way to decode q-encoded strings in Ruby?

拈花ヽ惹草 提交于 2019-12-01 04:36:53
问题 I'm working with mails, and names and subjects sometimes come q-encoded, like this: =?UTF-8?Q?J=2E_Pablo_Fern=C3=A1ndez?= Is there a way to decode them in Ruby? It seems TMail should take care of it, but it's not doing it. 回答1: I use this to parse email subjects: You could try the following: str = "=?UTF-8?Q?J=2E_Pablo_Fern=C3=A1ndez?=" if m = /=\?([A-Za-z0-9\-]+)\?(B|Q)\?([!->@-~]+)\?=/i.match(str) case m[2] when "B" # Base64 encoded decoded = Base64.decode64(m[3]) when "Q" # Q encoded