Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use unsafe ~ character. #45

Closed
zharikovpro opened this issue Jan 4, 2018 · 8 comments
Closed

Don't use unsafe ~ character. #45

zharikovpro opened this issue Jan 4, 2018 · 8 comments

Comments

@zharikovpro
Copy link

TLDR: follow the RFC for URLs. Complete reasoning.

@zharikovpro
Copy link
Author

~ can be safely replaced with _

@ai
Copy link
Owner

ai commented Jan 5, 2018

@zharikovpro we already have _ in the alphabet.

This article has a problem, it tells that - is safe, but it is not dylang/shortid#96
This is a reason why ~ was added to Nano ID, because it is safe in practice and - is safe in theory.

Do you know any practical problems with ~?

@zharikovpro
Copy link
Author

@ai I personally have no real troubles with - or ~. It's all about quote from RFC:

Other characters are unsafe because
gateways and other transport agents are known to sometimes modify
such characters. These characters are "{", "}", "|", "", "^", "~",
"[", "]", and "`".

It may be that ~ also has some weird issues, like one that you referenced for the -. I posted this issue just in case.

Also, I was choosing a short id lib and came to this warning, so this issue may affect library adoption.

@ai
Copy link
Owner

ai commented Jan 5, 2018

OK, I will think about it later. Current symbols are safe and work. But I understand that following RFC is good idea.

If you don't like ~ you can replace alphabet. I recommend to not use - as well.

@shesek
Copy link

shesek commented Jan 14, 2018

How about replacing ~ in the alphabet with a .?

@shesek
Copy link

shesek commented Jan 14, 2018

Though, it appears like RFC 3986 says that ~ is URL safe?

2.3.  Unreserved Characters

   Characters that are allowed in a URI but do not have a reserved
   purpose are called unreserved.  These include uppercase and lowercase
   letters, decimal digits, hyphen, period, underscore, and tilde.

      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

https://www.ietf.org/rfc/rfc3986.txt

@ai
Copy link
Owner

ai commented Jan 14, 2018

I afraid . in the end of the string will be removed from link on Android and etc

@ai
Copy link
Owner

ai commented Jan 15, 2018

Also ~ was very popular in 90-2000s as part of user’s directory on the domain: domain.com/~user. I think ~ is safe.

@ai ai closed this as completed Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants