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

normalized_path full-width chars japanese #375

Closed
ignacio-chiazzo opened this issue Jan 14, 2020 · 1 comment
Closed

normalized_path full-width chars japanese #375

ignacio-chiazzo opened this issue Jan 14, 2020 · 1 comment

Comments

@ignacio-chiazzo
Copy link

ignacio-chiazzo commented Jan 14, 2020

Using the normalized_path method turns the Japanese into 1. This also happens for 2 -> 2 etc. (More about half-width and half-width characters and numbers here)

 url = "http://a.com/%EF%BC%91" # http://a.com/1 
Addressable::URI.parse(url).normalized_path # "/1"
[152] pry(main)> url = "http://a.com/%EF%BC%91" # http://a.com/1 
=> "http://a.com/%EF%BC%91"
[153] pry(main)> Addressable::URI.parse(url).normalized_path # 
=> "/1"
[154] pry(main)> 

Looks like it was done on purpose on the lines

result = path.strip.split(SLASH, -1).map do |segment|
Addressable::URI.normalize_component(
segment,
Addressable::URI::CharacterClasses::PCHAR
)

Am I missing something from the RFC?

@dentarg
Copy link
Collaborator

dentarg commented Jan 14, 2020

Addressable is using NFKC normalization, so this is expected.

See #8 (comment) and other issues like #217 and #325.

https://towardsdatascience.com/difference-between-nfd-nfc-nfkd-and-nfkc-explained-with-python-code-e2631f96ae6c has some examples for different forms of normalization.

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

2 participants