Why would you reduce the page ID in length with base 36? They're, what, 10
digits?
Roan Kattouw (Catrope)
Hi, Roan, base 36 encoding/decoding is very cheap in Javascript, just call
* parseInt(string, radix) * number.toString(radix)
Where radix is range from 2 to 36. You know, combining 0~9 and a ~z, we get 36 letters.
you should consider base32 j
base 36 is more compact than base 32.
URL has Read-Only access Sadik Khalid
Hi, Sadik,
I use github to manage the versions of my code. You can send me the code directly via mail, and I will merge it to the code. Thanks.
Some admin actions mess up pageid (and I did some from time to time), so your idea that a page id identifies a title is buggy. Liangent
Hi, Liangent,
Thanks for you response. How dose admin actions mess up pageid? Could you give me some example, so I would try to find a way to avoid it.
On Tue, Aug 3, 2010 at 11:59 PM, Mingli Yuan mingli.yuan@gmail.com wrote:
Hi, folks,
For many languages which dose not use Latin characters, the URL of an articles in Wikipedia might be very long. This is the case for Chinese Wikipedia.
So in order to help people on this problem, I create a small project to solve it, and it runs successfully on my local machine. Although I dose not deploy it to a public server yet, I decided to make the code public first. You can get the code at http://github.com/mountain/shortify
It uses API call to get pageId by the title, and then convert pageId by base 36 to the short url. It is quite simple. To reduce the frequency of API call, a simple cache was used. So far, only Chinese and English were supported.
If you think your language need such kind a tool, please help me localize the i18n config file at http://github.com/mountain/shortify/blob/master/config/i18n.js
Comments are welcomed. If you can help setup a server, that would be nice and please contact me separately.
Regards,
Mingli (User:Mountain)