url 缩短与 unicode 转换为 ids?
我需要为工作制作一个 url 缩短器,所以我试图找出最好的架构,以在尽可能小的 id 字符串中提供尽可能多的链接。
我曾想过将 unicode 字符转换为位值以用作简单数据库的 id ——这样的事情可能吗?是否有任何特定的 unicode 字符根本不会转发到服务器?我可以按原样访问原始地址字符串,以准确找出输入的网址,但我需要确保应该存在的所有内容都存在。 # 是一个我不确定的特殊例子;它是客户端功能(锚点),我不知道它是否真的到达服务器。
我不需要生成的 id 具有任何随机性,我想只是从最低的 unicode 位值递增到最高,基本上每个字符都有成千上万种可能性。
如有任何建议、帮助或代码示例,我们将不胜感激。 :)
I need to make a url shortener for work, so I'm trying to figure out what is going to be the best schema to provide the largest possible number of links in the smallest possible id string.
I had thought of converting unicode characters to bit values to use as ids for a simple database--is such a thing possible? Is there any particular unicode characters that wouldn't get relayed to the server at all? I can access the raw address string as-is to find out exactly what url was entered, but I need to make sure everything that should be there is there. # is one particular example I am unsure of; it being a client-side functionality (anchors), I don't know if it actually gets to the server.
I don't need any randomness to the generated id, I was thinking of just incrementing from the lowest unicode bit value to the highest, basically getting thousands upon thousands of possibilities per-character.
Any advice, help or code samples are appreciated. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论