url 缩短与 unicode 转换为 ids?

发布于 2024-09-08 13:46:56 字数 361 浏览 0 评论 0原文

我需要为工作制作一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文