decode

UTF8 Encoding in Android when invoking REST webservice

本秂侑毒 提交于 2019-11-30 10:35:46
I'm invoking a rest WS that returns XML. Some elements have strings include special characters like áãç etc... When I get the information via browser all of it is shown properly but when invoking it from Android I don't get the proper special characters. Notice the 'decoded' and 'encoded' variables: when I use URLDecoder.decode(result, "UTF-8") The result stays the same when I use URLEncoder.encode(result, "UTF-8") The result changes to what it would be expected (full of %'s symbols and numeric representing symbols and special characters). Here's the method to call the webservice: public void

Swift base64 decoding returns nil

我与影子孤独终老i 提交于 2019-11-30 08:49:52
I am trying to decode a base64 string to an image in Swift using the following code: let decodedData=NSData(base64EncodedString: encodedImageData, options: NSDataBase64DecodingOptions.IgnoreUnknownCharacters) Unfortunately, the variable decodedData turns out to have a value of nil Debugging through the code, I verified that the variable encodedImageData is not nil and is the correct encoded image data(verified by using an online base64 to image converter). What could possibly be the reason behind my issue? This method requires padding with “=“, the length of the string must be multiple of 4.

Decoding Base64 Image

心不动则不痛 提交于 2019-11-30 08:37:15
I have got a Base64 image in an HTML embedded, how can I decode this using C# or VB.net. servermanfail google.com > base64 image decode c# > http://www.eggheadcafe.com/community/aspnet/2/39033/convert-base64-string-to-image.aspx Byte[] bitmapData = Convert.FromBase64String(FixBase64ForImage(ImageText)); System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData); Bitmap bitImage = new Bitmap((Bitmap)Image.FromStream(streamBitmap)); public string FixBase64ForImage(string Image) { System.Text.StringBuilder sbText = new System.Text.StringBuilder(Image,Image.Length); sbText

Convert ' to an apostrophe in PHP

半城伤御伤魂 提交于 2019-11-30 08:18:15
My data has many HTML entities in it ( • ...etc) including ' . I just want to convert it to its character equivalent. I assumed htmlspecialchars_decode() would work, but - no luck. Thoughts? I tried this: echo htmlspecialchars_decode('They're here.'); But it returns: They're here. Edit: I've also tried html_entity_decode(), but it doesn't seem to work: echo html_entity_decode('They're here.') also returns: They're here. Since ' is not part of HTML 4.01, it's not converted to ' by default. In PHP 5.4.0, extra flags were introduced to handle different languages,

How to decode audio via FFmpeg in Android

[亡魂溺海] 提交于 2019-11-30 07:44:33
I am writing a player for Android with FFmpeg compiled for Android NDK. I could open the file through FFmpeg and wrote this: av_register_all(); char* str = (*env) -> GetStringUTFChars(env, argv, 0); __android_log_print(ANDROID_LOG_INFO, "HelloNDK!", str, str); if (av_open_input_file (&pFormatCtx, str, NULL, 0, NULL) != 0) return -2; // Couldn't open file // Retrieve stream information if (av_find_stream_info(pFormatCtx) < 0) return -3; // Couldn't find stream information // Dump information about file onto standard error dump_format(pFormatCtx, 0, argv, 0); // Find the first video stream

Error code -8969, -12909 while decoding h264 in iOS 8 with video tool box

徘徊边缘 提交于 2019-11-30 06:50:44
I have the h264 stream inAnnex B format and follow this link here to implements h264 decoding with iOS8 videoToolBox. I check the OSStatus in every step. use CMVideoFormatDescriptionCreateFromH264ParameterSets with the SPS and PPS data to create a CMFormatDescription.(status == noErr) create a VTDecompressionSession using VTDecompressionSessionCreate. (status == noErr) capture the NALUnit payload into a CMBlockBuffer making sure to replace the start code with a byte length code. (status == noErr) create a CMSampleBuffer. (status == noErr) use VTDecompressionSessionDecodeFrame and get error

DOM Exception 5 INVALID CHARACTER error on valid base64 image string in javascript

走远了吗. 提交于 2019-11-30 06:10:54
I'm trying to decode a base64 string for an image back into binary so it can be downloaded and displayed locally by an OS. The string I have successfully renders when put as the src of an HTML IMG element with the data URI preface (data: img/png;base64, ) but when using the atob function or a goog closure function it fails. However decoding succeeds when put in here: http://www.base64decode.org/ Any ideas? EDIT: I successfully got it to decode with another library other than the built-in JS function. But, it still won't open locally - on a Mac says it's damaged or in an unknown format and can

Why doesn't decodeURI(“a+b”) == “a b”?

自作多情 提交于 2019-11-30 06:10:54
I'm trying to encode URLs in Ruby and decode them with Javascript. However, the plus character is giving me weird behavior. In Ruby: [Dev]> CGI.escape "a b" => "a+b" [Dev]> CGI.unescape "a+b" => "a b" So far so good. But what about Javascript? >>> encodeURI("a b") "a%20b" >>> decodeURI("a+b") "a+b" Basically I need a method of encoding / decoding URLs that works the same way in Javascript and Ruby. Edit: decodeURIComponent is no better: >>> encodeURIComponent("a b") "a%20b" >>> decodeURIComponent("a+b") "a+b" You might want to look at URI.encode and URI.decode : require 'uri' URI.encode('a + b

Decoding Video using FFMpeg for android

浪子不回头ぞ 提交于 2019-11-30 05:05:09
I tried to decode video using FFMpeg library from the sample examples available on internet, i figure it out with new version of ffmpeg, here is the code which I called from my class file, private static native int decodeVideo(String filename); decodeVideo(getString(R.string._sdcard_abc_3gp)); now in .c file located in JNI dir,I wrote this code, jint Java_ru_dzakhov_ffmpeg_test_MainActivity_decodeVideo(JNIEnv* env, jobject javaThis,jstring filename) { AVFormatContext *pFormatCtx; int i, videoStream; AVCodecContext *pCodecCtx; AVCodec *pCodec; AVFrame *pFrame; AVFrame *pFrameRGB; AVPacket

How to decode the JWT encoded token payload on client-side in angular 5?

99封情书 提交于 2019-11-30 02:56:24
I am getting one JWT encoded access token from my API in response. But I am not able to decode it and get it in JSON format. I tried using the angular2-jwt library for it, but it did not worked. I am writing my code below: setXAuthorizationToken(client){ let requestHeader = new Headers(); requestHeader.append('Content-Type', 'application/x-www-form-urlencoded'); this.http.post(client.clientURL + "oauth/token", 'grant_type=password&client_id=toto&client_secret=sec&' + 'username=' + client.username + '&password=' + client.password, { headers: requestHeader }).map(res=>res.json()) .subscribe(