Google
 

«           »

Handling Unicode Data in Amazon S3 Headers

Posted December 28, 2008 – 5:38 pm by Yakov Shafranovich in Programming

During a recent project, I ran into an issue when handling Unicode data in metadata headers in Amazon S3. Apparently, Amazon adds on “?UTF-8?B?” in front of any Unicode data and “?=” in end of the data. I could not find any existing standard that describes this or why it is done, but I surmise this probably has to do with Base-64 encoding and how it handles Unicode.

An easy Perl hack to get around this is as following (assuming you are using MIME::Base64 module):

if($var =~ m/^\=\?UTF-8\?B\?(.*)\?=/) {
    $results = decode_base64($var);
}

Tags: , ,

Permalink | Trackback URL | This post has

Post a Comment