Standard Base62 Encoding?

Is there a standard encoding for base62? I’ve been using 0…9a…zA…Z,
but I think I should switch that to 0…9A…Za…z, so it would sort
properly according to ASCII order. I wasn’t able to find anything on a
standard via a Google search. So maybe there just isn’t one?

I was kind of surprised to see Ruby uses lower case a…f for
hexadecimal rather than uppercase.

"255.to_s(16) #=> “ff”

On Nov 1, 1:27pm, Intransition [email protected] wrote:

Is there a standard encoding for base62? I’ve been using 0…9a…zA…Z,
but I think I should switch that to 0…9A…Za…z, so it would sort
properly according to ASCII order. I wasn’t able to find anything on a
standard via a Google search. So maybe there just isn’t one?

I was kind of surprised to see Ruby uses lower case a…f for
hexadecimal rather than uppercase.

"255.to_s(16) #=> “ff”

Where is base 62 used?

On 01.11.2010 20:27, Intransition wrote:

Is there a standard encoding for base62? I’ve been using 0…9a…zA…Z,
but I think I should switch that to 0…9A…Za…z, so it would sort
properly according to ASCII order. I wasn’t able to find anything on a
standard via a Google search. So maybe there just isn’t one?

I was kind of surprised to see Ruby uses lower case a…f for
hexadecimal rather than uppercase.

"255.to_s(16) #=> “ff”

irb(main):003:0> “0x%02X” % 255
=> “0xFF”

I have no idea though, why you want to use Base62 encoding when there is
a standard implementation of Base64 encoding.

irb(main):005:0> require ‘base64’
=> true
irb(main):006:0> Base64.encode64 “\000\001”
=> “AAE=\n”

Kind regards

robert

On Nov 1, 6:20pm, Robert K. [email protected] wrote:

"255.to_s(16) #=> “ff”

irb(main):003:0> “0x%02X” % 255
=> “0xFF”

I have no idea though, why you want to use Base62 encoding when there is
a standard implementation of Base64 encoding.

I’m not using it as such. My question is for my Radix project which
can convert any base to any other. 62 is the max limit for a string
representation of a number. I wanted to keep them limited to Latin
characters.

As for as base-62, from what I understand is used for basically that
same reason. Say you want to “scramble” file names, but need to make
sure they are still valid filenames. Encoding in Base-62 is good for
that.

Even easier, for base64, no requires needed.

ruby-1.9.2-p0 > ["\000\001"].pack(“m”)
=> “AAE=\n”