<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Base36 Encoder/Decoder in C#</title>
	<atom:link href="http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/</link>
	<description>Random thoughts of neat disorder</description>
	<lastBuildDate>Wed, 11 Jan 2012 04:38:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: mstum</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-66288</link>
		<dc:creator>mstum</dc:creator>
		<pubDate>Fri, 25 Nov 2011 23:56:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-66288</guid>
		<description>I&#039;ve just updated the Library on GitHub to add a BigInteger Version. This should ensure compatibility with large numbers in situations where a long overflows.</description>
		<content:encoded><![CDATA[<p>I've just updated the Library on GitHub to add a BigInteger Version. This should ensure compatibility with large numbers in situations where a long overflows.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mstum</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-66287</link>
		<dc:creator>mstum</dc:creator>
		<pubDate>Fri, 25 Nov 2011 23:54:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-66287</guid>
		<description>Yes, you will need to ensure Integer Division. In C#, the / operator is overloaded and performs integer division if both operands are integers, otherwise it does double division.</description>
		<content:encoded><![CDATA[<p>Yes, you will need to ensure Integer Division. In C#, the / operator is overloaded and performs integer division if both operands are integers, otherwise it does double division.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mika Tähtinen</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-66228</link>
		<dc:creator>Mika Tähtinen</dc:creator>
		<pubDate>Fri, 25 Nov 2011 12:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-66228</guid>
		<description>I ran into some problems converting this code to Visual Basic with .NET Framework 3.5. It seems that division with &quot;/&quot; uses double precision. The solution is to force integer division using &quot;\=&quot; instead of &quot;/=&quot;.</description>
		<content:encoded><![CDATA[<p>I ran into some problems converting this code to Visual Basic with .NET Framework 3.5. It seems that division with "/" uses double precision. The solution is to force integer division using "\=" instead of "/=".</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kk</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-62547</link>
		<dc:creator>kk</dc:creator>
		<pubDate>Thu, 03 Nov 2011 20:41:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-62547</guid>
		<description>nwisoft&#039;s syntax works fine and is C#, the problem is when he pasted it in the syntax got changed.
the syntax for List   should be List followed by less then followed by &quot;char&quot; followed by greater then.  If you change the syntax it works fine.</description>
		<content:encoded><![CDATA[<p>nwisoft's syntax works fine and is C#, the problem is when he pasted it in the syntax got changed.<br />
the syntax for List   should be List followed by less then followed by "char" followed by greater then.  If you change the syntax it works fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mstum</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-41898</link>
		<dc:creator>mstum</dc:creator>
		<pubDate>Fri, 22 Jul 2011 03:23:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-41898</guid>
		<description>That&#039;s indeed true, input should have 12 characters or less. This is more intended for database IDs that should turn into URLs. If you are on .net 4, this method can be made a lot more robust through the use of System.Numerics.BigInteger.</description>
		<content:encoded><![CDATA[<p>That's indeed true, input should have 12 characters or less. This is more intended for database IDs that should turn into URLs. If you are on .net 4, this method can be made a lot more robust through the use of System.Numerics.BigInteger.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-41894</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 22 Jul 2011 03:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-41894</guid>
		<description>Math.Pow(36, index) returns a double that may cause errors at very large numbers when its casted to the long.</description>
		<content:encoded><![CDATA[<p>Math.Pow(36, index) returns a double that may cause errors at very large numbers when its casted to the long.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff O</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-41056</link>
		<dc:creator>Jeff O</dc:creator>
		<pubDate>Sun, 17 Jul 2011 11:31:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-41056</guid>
		<description>@Jérémie:

Is there any (even slight) chance that this line on your computer may have some localized characters like those that appear in your name? ;-)

private const string CHARACTERS = &quot;0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;</description>
		<content:encoded><![CDATA[<p>@Jérémie:</p>
<p>Is there any (even slight) chance that this line on your computer may have some localized characters like those that appear in your name? <img src='http://www.stum.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>private const string CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mstum</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-27755</link>
		<dc:creator>mstum</dc:creator>
		<pubDate>Tue, 29 Mar 2011 23:18:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-27755</guid>
		<description>@Jérémie That&#039;s strange, it works for me on both .net 3.5 and 4.0:

	long input = 5481594952936519619L;
	var encoded = Base36.Encode(input);
	Console.WriteLine(encoded);
	var decoded = Base36.Decode(encoded);
	Console.WriteLine(decoded);
	Console.WriteLine(input == decoded);

Output is:
15n9z8l3au4eb
5481594952936519619
True

How are you using it? I have tried both the above code and the slightly revised version on GitHub with the same result.</description>
		<content:encoded><![CDATA[<p>@Jérémie That's strange, it works for me on both .net 3.5 and 4.0:</p>
<p>	long input = 5481594952936519619L;<br />
	var encoded = Base36.Encode(input);<br />
	Console.WriteLine(encoded);<br />
	var decoded = Base36.Decode(encoded);<br />
	Console.WriteLine(decoded);<br />
	Console.WriteLine(input == decoded);</p>
<p>Output is:<br />
15n9z8l3au4eb<br />
5481594952936519619<br />
True</p>
<p>How are you using it? I have tried both the above code and the slightly revised version on GitHub with the same result.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jérémie R</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-27737</link>
		<dc:creator>Jérémie R</dc:creator>
		<pubDate>Tue, 29 Mar 2011 16:07:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-27737</guid>
		<description>I tried to use this code but it did not work fine.
Try to convert this number : 5481594952936519619
and when I revert I got : 5613318295101298955
as you see there is a problem there</description>
		<content:encoded><![CDATA[<p>I tried to use this code but it did not work fine.<br />
Try to convert this number : 5481594952936519619<br />
and when I revert I got : 5613318295101298955<br />
as you see there is a problem there</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dani Rubio</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-26136</link>
		<dc:creator>Dani Rubio</dc:creator>
		<pubDate>Wed, 02 Mar 2011 03:03:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-26136</guid>
		<description>@nwisoft
What languaje is that, not csharp guess.. i&#039;m getting mad with your &quot;List&quot; utilization...
I&#039;ll better look for the publisher&#039;s one...</description>
		<content:encoded><![CDATA[<p>@nwisoft<br />
What languaje is that, not csharp guess.. i'm getting mad with your "List" utilization...<br />
I'll better look for the publisher's one...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Not Rocket Science &#187; Misc Utilities Library</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-23461</link>
		<dc:creator>Not Rocket Science &#187; Misc Utilities Library</dc:creator>
		<pubDate>Mon, 27 Dec 2010 09:12:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-23461</guid>
		<description>[...] Base36 Encoder/Decoder in C# [...]</description>
		<content:encoded><![CDATA[<p>[...] Base36 Encoder/Decoder in C# [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: synhershko</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-15629</link>
		<dc:creator>synhershko</dc:creator>
		<pubDate>Thu, 18 Mar 2010 19:00:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-15629</guid>
		<description>Wikipedia had a C# sample, which wasn&#039;t working. I updated the code there to use your methods instead, which are working great.</description>
		<content:encoded><![CDATA[<p>Wikipedia had a C# sample, which wasn't working. I updated the code there to use your methods instead, which are working great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kofi Sarfo</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-3352</link>
		<dc:creator>Kofi Sarfo</dc:creator>
		<pubDate>Thu, 19 Mar 2009 16:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-3352</guid>
		<description>Thanks so much for having posted this. It saved me however long I&#039;d have been fooling around rolling my own implementation :)

Kofi</description>
		<content:encoded><![CDATA[<p>Thanks so much for having posted this. It saved me however long I'd have been fooling around rolling my own implementation <img src='http://www.stum.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Kofi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nwisoft</title>
		<link>http://www.stum.de/2008/10/20/base36-encoderdecoder-in-c/comment-page-1/#comment-965</link>
		<dc:creator>nwisoft</dc:creator>
		<pubDate>Thu, 06 Nov 2008 10:15:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.stum.de/?p=241#comment-965</guid>
		<description>//Thank you for this good sample.
//You just need to Trim start zeros to avoid wrong result : &quot;0H&quot; must return 17.

private const string CHARACTERS = &quot;0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;;

static public long Decode(string value) 
{
      List database = new List(CHARACTERS);
      List tmp = new List(value.ToUpper().TrimStart(new char[] { &#039;0&#039; }).ToCharArray());
      tmp.Reverse();

      long number = 0; 
      int index = 0; 
      foreach (char character in tmp) 
      { 
           number += database.IndexOf(character) * (long)Math.Pow(36, index); 
           index++; 
      } 
            
      return number; 
}

static private string Encode(long number) 
{
      List database = new List(CHARACTERS);
      List value = new List();
      long tmp = number;

      while (tmp != 0)
      {
           value.Add(database[Convert.ToInt32(tmp % 36)]);
           tmp /= 36;
      }

      value.Reverse();
      return new string(value.ToArray());
}</description>
		<content:encoded><![CDATA[<p>//Thank you for this good sample.<br />
//You just need to Trim start zeros to avoid wrong result : "0H" must return 17.</p>
<p>private const string CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";</p>
<p>static public long Decode(string value)<br />
{<br />
      List database = new List(CHARACTERS);<br />
      List tmp = new List(value.ToUpper().TrimStart(new char[] { '0' }).ToCharArray());<br />
      tmp.Reverse();</p>
<p>      long number = 0;<br />
      int index = 0;<br />
      foreach (char character in tmp)<br />
      {<br />
           number += database.IndexOf(character) * (long)Math.Pow(36, index);<br />
           index++;<br />
      } </p>
<p>      return number;<br />
}</p>
<p>static private string Encode(long number)<br />
{<br />
      List database = new List(CHARACTERS);<br />
      List value = new List();<br />
      long tmp = number;</p>
<p>      while (tmp != 0)<br />
      {<br />
           value.Add(database[Convert.ToInt32(tmp % 36)]);<br />
           tmp /= 36;<br />
      }</p>
<p>      value.Reverse();<br />
      return new string(value.ToArray());<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

