decode

Is u'string' the same as 'string'.decode('XXX')

拈花ヽ惹草 提交于 2020-01-02 03:25:08
问题 Although the title is a question, the short answer is apparently no. I've tried in the shell. The real question is why? ps: string is some non-ascii characters like Chinese and XXX is the current encoding of string >>> u'中文' == '中文'.decode('gbk') False //The first one is u'\xd6\xd0\xce\xc4' while the second one u'\u4e2d\u6587' The example is above. I am using windows chinese simplyfied. The default encoding is gbk, so is the python shell. And I got the two unicode object unequal. UPDATES a =

Decode python base64 String

走远了吗. 提交于 2020-01-02 01:15:12
问题 I have extracted base64 string of forecolor, texture and edgemap values of images, I have a list with following structure: forecolor=AgCEAg4DUQQCBQQGARMBFQE1AmUB edge=AfCAFg5iIATCPwTAEIiBFggBDw forecolor=AgAsAQ0CJAMcDRgOGg8DHQYeBzYBPQ4-DU0ETgNtBm4CfQI I am trying to decode these values, but I am getting Incorrect Padding error, here is the exact error: Traceback (most recent call last): File "ImageVectorData.py", line 44, in <module> print "Decoded String: " + decoded.decode('base64', 'strict

Fastest PNG decoder for .NET

﹥>﹥吖頭↗ 提交于 2020-01-01 01:14:20
问题 Our web server needs to process many compositions of large images together before sending the results to web clients. This process is performance critical because the server can receive several thousands of requests per hour. Right now our solution loads PNG files (around 1MB each) from the HD and sends them to the video card so the composition is done on the GPU. We first tried loading our images using the PNG decoder exposed by the XNA API. We saw the performance was not too good. To

Android MediaCodec decode h264 raw frame

匆匆过客 提交于 2019-12-31 22:24:05
问题 I am using Android MediaCodec API to decode h264 frames. I could decode and render the frames on the view. My problem is the decoder miss lots of frames,especially the first some frames. DecodeMediaCodec.dequeueOutputBuffer() return -1. aAbout 150 h264 frames,just decoded 43 frames. I can not find where the problem is. Here is my codes. /** * init decoder */ private void initDecodeMediaCodec() { mDecodeMediaCodec = MediaCodec.createDecoderByType(MIME_TYPE); MediaFormat format = MediaFormat

H264: decode series of nal units with ffmpeg

我的未来我决定 提交于 2019-12-31 17:23:50
问题 I tried to decode a series of nal units with ffmpeg (libavcodec) but I get a "no frame" error. I produced the nal units with the guideline at How does one encode a series of images into H264 using the x264 C API?. I tried the following strategy for decoding: avcodec_init(); avcodec_register_all(); AVCodec* pCodec; pCodec=lpavcodec_find_decoder(CODEC_ID_H264); AVCodecContext* pCodecContext; pCodecContext=lpavcodec_alloc_context(); avcodec_open(pCodecContext,pCodec); AVFrame *pFrame; pFrame

how to decode a url in vb.net

无人久伴 提交于 2019-12-31 01:54:12
问题 This line says server is not declared. Dim DecodedString As String = server.UrlDecode(context.Request.Form("DeckName")) I have imports system.web at the top. cannot seem to figure out why its not working. 回答1: Use HttpUtility instead. Dim decodedUrl As String = HttpUtility.UrlDecode(encodedUrl) More details here: http://msdn.microsoft.com/en-us/library/system.web.httputility.urldecode.aspx 回答2: This is old and K3N already provided a great answer.. but I believe the 's' in 'server' should be

JLayer Mono Mp3 to PCM decoding

折月煮酒 提交于 2019-12-30 12:23:48
问题 I am currently working on mp3 decoding with javalayer 1.1. So I want to receive the raw PCM data from my 44100 Hz, 16bit, Mp3s. It is perfectly working fine with stereo mp3s, but i have strange issues with mono mp3s. Here some code. InputStream data = c.getResources().openRawResource(resId); Bitstream bitstream = new Bitstream(data); Decoder decoder = new Decoder(); while(thereIsData) { Head frameHeader = bitstream.readFrame(); SampleBuffer buffer = (SampleBuffer) decoder.decodeFrame

Why does json_decode return null for empty array?

霸气de小男生 提交于 2019-12-30 08:18:50
问题 Why would this echo "NULL"? In my would it would be decoded to an empty array. Is it something obvious I'm missing? <?php $json = json_encode(array()); $json_decoded = json_decode($json, true); // same with json_decode($json); if ($json_decoded == null){ echo "NULL"; } else { echo "NOT NULL"; } ?> 回答1: This is because array()==NULL . It does not check the object type in this case. gettype(null) returns null, whereas gettype(array()) returns array. Hope you got the difference. Probably what

Decode UTF-8 URL in Perl

女生的网名这么多〃 提交于 2019-12-30 04:49:05
问题 Consider: use URI::Escape; print uri_unescape("%C3%B3"); Output : ó Decode with this http://meyerweb.com/eric/tools/dencoder/ Output : ó This is the expected one. What Perl library should I use to get the correct output? 回答1: If you know that the byte sequence is UTF-8, then use Encode::decode : use Encode; use URI::Escape; my $in = "%C3%B3"; my $text = Encode::decode('utf8', uri_unescape($in)); print length($text); # Should print 1 回答2: The code Encode::decode('utf8', uri_unescape($in))

WebSphere Portal decode url

情到浓时终转凉″ 提交于 2019-12-30 02:29:11
问题 How I can decode WebSphere Portal url? For example this url: /wps/portal/!ut/p/c5/dY7LdoIwAAW_hS9ICEnEZSBaKBSKkUfZcAKtKRYMKo-2X197XHtnObO4oAQ3TnJulRxbfZIdKEBJK2wn24ylATUpWUNfhLt9anHTJgg8g1J1ur6VOX_T31wzxRk_4NHZobEvzs5Vu6o3942nbJRTEpNl-UHmoK5JGlfvpOHThtV04ksmNlac5oHuz-HWb4QMcTQHr11SE3xZTUPdz9GvKwkTRfsydMdJHrQTd-vPizIMkP8_p5X7xDy8CiGMUQYhiohIYCos6Ft3Dx-MQRB5uv8Aw1cNj5gZfxocKIs!/dl3/d3/L2dJQSEvUUt3QS9ZQnZ3LzZfNDhRRlZBVUs2UEZMRDBJU1RDTEZIRTEwTDM!/ Is it possible? 回答1: Try the following: /wps/poc