Base64 data: URLs vs url encoding

Hi,

  print URI->new('data:;base64,QmpvZXJu')->data;
  print URI->new('data:;base64,%51%6D%70%76%5A%58%4A%75')->data;

I think this should both print "Bjoern", but in the second case the
module returns garbage (URI 1.35).

regards,
-- 
Bj�rn H�hrmann � mailto:bjoern@hoehrmann.de � http://bjoern.hoehrmann.de
Weinh. Str. 22 � Telefon: +49(0)621/4309674 � http://www.bjoernsworld.de
68309 Mannheim � PGP Pub. KeyID: 0xA4357E78 � http://www.websitedev.de/ 
0
derhoermi
4/19/2006 6:56:28 AM
perl.libwww 3335 articles. 0 followers. Follow

1 Replies
826 Views

Similar Articles

[PageSpeed] 31

Bjoern Hoehrmann <derhoermi@gmx.net> writes:

> Hi,
> 
>   print URI->new('data:;base64,QmpvZXJu')->data;
>   print URI->new('data:;base64,%51%6D%70%76%5A%58%4A%75')->data;
> 
> I think this should both print "Bjoern", but in the second case the
> module returns garbage (URI 1.35).

Thanks for your report.  I've applied the following patch to fix this
bug:

Index: URI/data.pm
===================================================================
RCS file: /cvsroot/libwww-perl/uri/URI/data.pm,v
retrieving revision 4.4
diff -u -p -r4.4 data.pm
--- URI/data.pm	14 Jan 2004 13:33:44 -0000	4.4
+++ URI/data.pm	19 Apr 2006 11:01:01 -0000
@@ -55,7 +55,8 @@ sub data
 	$self->opaque("$enc,$new");
     }
     return unless defined wantarray;
-    return $base64 ? decode_base64($data) : uri_unescape($data);
+    $data = uri_unescape($data);
+    return $base64 ? decode_base64($data) : $data;
 }
 
 # I could not find a better way to interpolate the tr/// chars from
Index: t/data.t
===================================================================
RCS file: /cvsroot/libwww-perl/uri/t/data.t,v
retrieving revision 1.4
diff -u -p -r1.4 data.t
--- t/data.t	5 Aug 2003 15:27:49 -0000	1.4
+++ t/data.t	19 Apr 2006 11:01:01 -0000
@@ -9,7 +9,7 @@ if ($@) {
     exit;
 }
 
-print "1..21\n";
+print "1..22\n";
 
 use URI;
 
@@ -106,3 +106,5 @@ $old = $u->data("new");
 print "not " unless $old eq "" && $u eq "data:bar%2Cb%E5z,new";
 print "ok 21\n";
 
+print "not " unless URI->new('data:;base64,%51%6D%70%76%5A%58%4A%75')->data eq "Bjoern";
+print "ok 22\n";
0
gisle
4/19/2006 11:03:53 AM
Reply:

Similar Artilces:

[url][/url]
I want to use this function [url][/url] when posting a link in my guestbook, the code is not working fully, thats why I want you to help me out with the last bit. Thanks As an example, when I want to post a link I save [url]http://www.asp.net[/url] this in the database. Then when the guestbook is getting it from the database I want it to replace it to a link. But something is wrong with the code.....can you help please. RS("post").Replace("[url","<a target=""_blank"" href=").Replace("[/url","</a").Replace(&q...

transmit base64 data through URL
 Greeting all,I have some encrypted data that i would like to send to the server using URL in the query string parameter.When i place that data in the query string from javascript function on the server side it appears transformed as the slashes and + signs are transformed.I tried using HttpUtility.HtmlEncode() but that doesnt quite work.Any other ideas on how i can achieve this transfer using query string parameters?CheersDan Dan  Give HttpUtility.UrlEncode() a try. Cheers,       Kevin JonesMy Blog That doesnt work too.That will work with the...

Post data to an URL and open this URL in iFrame/TIWURLWindow
Hello, is it possible to post (http post) some data (XML) to an url (php file) and show the output/result in an iFrame (open that url in an iFrame)? Regards Mathias I have done it in the past using a TIdHTTP component from the Indy Clients tab. It allows you to post and capture the response. Once you have the results you can display them using a TStrings control with RawText set to true. You can place that inside a region to control where it gets displayed in your application. Am 08.10.2014 18:17, schrieb Daniel Fields: > I have done it in the past using a TIdHTTP compo...

superreview requested: [Bug 300183] Cannot attach the web page that its URL is encoded by non-UTF-8 URL encode : [Attachment 188762] Patch rv1.0
Masayuki Nakano (Mozilla Japan) <masayuki@d-toybox.com> has asked Scott MacGregor <mscott@mozilla.org> for superreview: Bug 300183: Cannot attach the web page that its URL is encoded by non-UTF-8 URL encode https://bugzilla.mozilla.org/show_bug.cgi?id=300183 Attachment 188762: Patch rv1.0 https://bugzilla.mozilla.org/attachment.cgi?id=188762&action=edit ...

superreview cancelled: [Bug 300183] Cannot attach the web page that its URL is encoded by non-UTF-8 URL encode : [Attachment 188762] Patch rv1.0
Scott MacGregor <mscott@mozilla.org> has cancelled Masayuki Nakano (Mozilla Japan) <masayuki@d-toybox.com>'s request for superreview: Bug 300183: Cannot attach the web page that its URL is encoded by non-UTF-8 URL encode https://bugzilla.mozilla.org/show_bug.cgi?id=300183 Attachment 188762: Patch rv1.0 https://bugzilla.mozilla.org/attachment.cgi?id=188762&action=edit ...

superreview granted: [Bug 300183] Cannot attach the web page that its URL is encoded by non-UTF-8 URL encode : [Attachment 188763] Patch rv1.0 -u8pw
Scott MacGregor <mscott@mozilla.org> has granted Scott MacGregor <mscott@mozilla.org>'s request for superreview: Bug 300183: Cannot attach the web page that its URL is encoded by non-UTF-8 URL encode https://bugzilla.mozilla.org/show_bug.cgi?id=300183 Attachment 188763: Patch rv1.0 -u8pw https://bugzilla.mozilla.org/attachment.cgi?id=188763&action=edit ...

clear private data does not clear recent urls from showing in url bar
Name: Rob Product: Firefox Summary: clear private data does not clear recent urls from showing in url bar Comments: I have heard that this is a feature? But it should clear when all private data is cleared. If you do not fix this, then recommend to me another browser because I will switch to another company and forget about firefox! Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to...

Image url for Gridview control whose url depends on data element
I currently have a gridview that is bound to a webservice. I can add a select hyperlink in the gridview that will pass the primary key for the selected row to the next page to get the details. I would like the select to be an image, however the image would be determined base on a value that is returned from the webservice. Example: I would like an image of Car if the itinerary type is "C". And I would like a plane if the itinerary type is "A". Here is my current code.   <asp:GridView ID="ItineraryGridView" runat="server" CellPadding="4" ForeColor="#333333" GridLines="Horizont...

Http Url Rewrite Modules vs Url Mapping in ASP.NET 2
In  Asp.Net 2 they added Url Mapping feature, before that we had to write a HttpModule to preform Url mapping, so which is better to use in Asp.Net 2? Most of the time I'd just go with the inbuilt URL Mapping now, however there are 2 exceptions I can think of: I want to use extensions other than .aspx or I want to allow for Regular Expressions in the URL syntax.    JamesMy Blog: http://www.wintersfamily.plus.com/blogs/JamesWinters...

The "Clear private data" does not clear the URL history in the URL field.
Name: Bertil Product: Firefox Release Candidate Summary: The "Clear private data" does not clear the URL history in the URL field. Comments: Clearing the browsing history using the "Clear private data" does not clear the URL history drop down menu in the URL field. Browser Details: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9) Gecko/2008061004 Firefox/3.0 From URL: http://hendrix.mozilla.org/ ...

Media URL/file handling question
Hello, I'm running Mozilla 1.6, as well as Firefox 0.8, on a MacOS X 10.3 system. The behavior I'm describing below is evident in both browsers. I've noticed that different media types are handled differently under my system depending on the player that the media is associated with. I have the three major media players under OS X (Quicktime, RealOne Player, and Windows Media Player 9) installed. If I click on a URL that points to a .mov or .mpg file, handled by Quicktime, the player is embedded in the browser window, and begins playing as soon as a sufficient b...

Edit URL / Navigate URL
Can anyone point me in the right direction. I am creating a module with a page that displays a datagrid, when a user clicks on the details link in the grid, it opens up a new page and needs to open the details.ascx page. I can't find the correct code to implement this. I am currently using:'><asp:hyperlink NavigateUrl=# EditURL("ProductID",DataBinder.Eval(Container.DataItem,"ProductID"))  Visible="True" runat="server" ID="hlEdit"'>using the EditURL code I can use this to open the edit page & edit my records.'>How do you add another link to the datagrid to open a Deta...

URL Encoding
Hello, Im using ASP.NET 1.1 with C# and VS 2003. Im using following code so that users could download the file. This code works all right on Internet Explorer but in FireFox if there is a space in file name (i.e. JG_new file.zip) then It doesnt download the file with full file name. It downloads the file as: "JG_New" and doesnt include the part after space. I dont know how to make it correct. The code is bellow:             for ( int i = 0; i <= objDS.Tables [ 0 ].Rows.Count - 1; i++ )        &n...

What encoding should be used in passing byte[] data through URL query string
I wanna pass some data, that's typed in byte array (byte[]), through the URL query string (e.g. http://localhost/sender/sender.aspx?data=xxx)what encoding should I convert the byte[] data into?...

Web resources about - Base64 data: URLs vs url encoding - perl.libwww

Text Encoding Initiative - Wikipedia, the free encyclopedia
The Text Encoding Initiative ( TEI ) is a text-centric community of practice in the academic field of digital humanities , operating continuously ...

Twitter image encoding challenge
If a picture's worth 1000 words, how much of a picture can you fit in 140 characters? Note : That's it folks! Bounty deadline is here, and after ...

【medical-news】Genetic Variation in NR1H4 Encoding the Bile Acid Receptor FXR - 医药生命科学动态跟踪 -丁香园论坛
Context: Bile acid signaling via farnesoid X receptor (FXR) regulates glucose and lipid levels, fat mass, and hepatic steatosis in animal models.Objective: ...

HandBrake Open Source video transcoder v0.10 released with hundreds of new features including H.265 and ...
... can be used for transcribing many different types of files/codecs to almost any other. Today’s headliner updates include H.265 and VP8 encoding. ...

CJK Type - CJK Fonts, Character Sets & Encodings. All CJK. All of the time.
As I wrote nearly a year ago , the Adobe-Identity-0 ROS is useful for building special-purpose fonts, especially CJK ones whose glyph coverage ...

Link Encoding Goes Mobile With Deep Links From Bitly
... Facebook and Google have been competing to bring the best solution for tracking deeplinks . This week, Bitly announced its own linking encoding ...

Encoding Articles - AppAdvice iPhone/iPad News
Latest Encoding Articles - AppAdvice iPhone/iPad News

AirMovie - Enjoy the videos in your PC anytime, anywhere with NO ENCODING!!
Holen Sie sich „AirMovie - Enjoy the videos in your PC anytime, anywhere with NO ENCODING!!“ im App Store. Sehen Sie sich Screenshots, Bewertungen ...

QuickTime 7.6 lands with H.264 encoding improvements, more
... of recommended security, compatibility, and reliability updates. QuickTime 7.6 , according to Apple, now improves single-pass H.264 encoding ...

Handbrake 0.9.6 gives some, takes some encoding features
The Handbrake Project has announced an update to its open-source, cross-platform video transcoding utility. Handbrake 0.9.6 includes new and ...

Resources last updated: 12/31/2015 2:38:52 PM