tags:

views:

550

answers:

1

In Flex, I have a GUID that I receive as input in the following format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" as a string. How would I convert this to a string of Base64 encoded values?

Please note that we have to account for leading zeroes in each section of the GUID, for example, "0091AFBC-8558-482A-9CF6-64F1745E7AC1"

A: 

Is this what you're after?

http://undefined.com/ia/2006/05/25/base64-encoding-for-actionscript-3flex-20/

Otherwise roll your own. The concept is fairly simple.

http://en.wikipedia.org/wiki/Base64 http://tools.ietf.org/rfc/rfc4648.txt

Matt H
EDIT: Why do you need to convert a printable GUID string into base64? The only reason to use Base64 encoding normally is to make the string 7-bit clean so that it can pass through systems that can't handle 8-bit data properly. e.g. like the old email protocols.The string you have here is 7-bit clean.
Matt H
@Matt: other reasons for converting Guids to Base64 is aesthetics. People sometimes get scared when they see a Guid, but a smaller set of alpha numerics is okay. Many many publicly facing systems do this. dM0bO5uZzEmzJwIwUOoTRQ is apparently more appealing than 082354EC-CB7A-42B1-8200-12D6A57DC2F0 and smaller too, when transfering a lot of them. ;)
Chris Lively
@Chris: I can imagine that if people got scared of a GUID that they'd be no less scared than seeing a bunch of numbers and letters that is only slightly shorter. You can just strip out the dashes and theres is hardly anything in it. Save yourself some coding overhead!
Matt H
@Matt: The usage of base64 is not an option, as it is due to compatibility with other components of our application which are essentially frozen.
Raul Agrait