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

Add "normalize" function for Unicode #80

Open
chexxor opened this issue Jun 1, 2017 · 3 comments
Open

Add "normalize" function for Unicode #80

chexxor opened this issue Jun 1, 2017 · 3 comments
Labels
type: enhancement A new feature or addition.

Comments

@chexxor
Copy link

chexxor commented Jun 1, 2017

@michaelficarra is adding functions for working with strings of Unicode code points. Normalization is an important part of supporting Unicode strings, as illustrated by a Spotify blogpost, Creative Usernames.

Looks like https://github.com/menelaos/purescript-stringutils/blob/v0.0.6/src/Data/String/Utils.purs#L221 has this function, but we can also add it here, as some functions in that repo presumes ES6 support, which isn't acceptable by all PS users.

IDK if we can add this function to this lib, though, as it looks like only MS Edge browser has str.normalize - MS docs: normalize. But most other browsers should have it - MDN: normalize

@MonoidMusician
Copy link
Contributor

@chexxor
Copy link
Author

chexxor commented Jan 14, 2019

Looks like that one is a binding to a Node lib [1], which is polyfill.
According to MDN [2], most browsers support normalize, so we shouldn't need a polyfill. I wonder if ES 2015 is an important consideration, though.

[1] https://github.com/walling/unorm
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize, most browser

@hdgarrood
Copy link
Contributor

I'm keen on adding this, especially given that all modern browsers support it. The only potential issue is what we do on platforms which don't support it. I think we have two options:

  1. Just return the same string, and call console.error explaining that normalize wasn't available and that this might break things,
  2. Throw an error immediately.

I'm not sure which of these I prefer, but I'm leaning towards the latter.

@JordanMartinez JordanMartinez added the type: enhancement A new feature or addition. label Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Projects
None yet
Development

No branches or pull requests

4 participants