Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

String.normalize needs info on normalization forms #2594

Closed
wbamberg opened this issue Dec 19, 2019 · 7 comments
Closed

String.normalize needs info on normalization forms #2594

wbamberg opened this issue Dec 19, 2019 · 7 comments
Assignees

Comments

@wbamberg
Copy link

Reported in Discourse: https://discourse.mozilla.org/t/string-normalize-needs-info-on-normalization-forms/50613 and quoted here for convenience:


The article String.normalize 1 needs a (brief) description or comparison between the four supported normalization forms. Reading the specs on this is hard, to say the least. It would be help to have a brief comparative description of each form, in one or two sentences.

The difference between composition and decomposition is sort of clear, if you have some understanding of how (de)composed characters work. People that don’t know about this, might easily choose the wrong form for their use case, or ignore having to normalize alltogether.

The difference between canonical and compatible, is complete abacadabra to me, although there surely are people that do get what they mean. Again, it needs a brief comparison to clear it up.

Since I don’t feel qualified to describe the differences myself, can I hereby request someone with a bit more knowledge on normalization, to do it for us? It’d be very much appreciated. Thanks.

@wbamberg wbamberg self-assigned this Dec 20, 2019
@wbamberg
Copy link
Author

Agreed that this page is not helpful. I forced myself to understand this stuff when working on the interactive example for it. I've forgotten it all of course but could probably resurrect it, so I can take this issue.

@wbamberg
Copy link
Author

wbamberg commented Dec 22, 2019

@wbamberg
Copy link
Author

It's not very brief, but I've written an expanded description of the concepts of canonical and compatibility normalization: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize#Description and how they can be applied using normalize().

@chrisdavidmills , please let me know if this makes sense and looks correct!

I think we also need a new interactive example, the current one isn't very good.

@chrisdavidmills
Copy link
Contributor

Nice writing @wbamberg ; very clear and understandable, and I enjoyed learning something new!

I made a couple of very minor text updates, changed the subheadings to add "normalization" to end of each as I thought it was more descriptive, and finally I changed the usage of const in the first couple of code blocks to let, as being able to redeclare those values makes it easier if you are testing them for example by typing them all into the JS console.

I think we can call this done.

@wbamberg
Copy link
Author

Thanks for the review, Chris, much appreciated.

I changed the usage of const in the first couple of code blocks to let, as being able to redeclare those values makes it easier if you are testing them for example by typing them all into the JS console.

This is my devtools bugbear! Unfortunately you can't redeclare let variables either, so it doesn't help a great deal. But it's a minor point, either way.

Writing examples like this makes me think that we (in a future version of MDN) should just let writers attach a flag to a code block saying "this is executable", then the platform would automatically make it interactive.

@chrisdavidmills
Copy link
Contributor

Unfortunately you can't redeclare let variables either, so it doesn't help a great deal. But it's a minor point, either way.

oop, terminology fail ;-) I meant "assign different values to them" — this means that you can test the entire code in the section in the console without having to reload the page. With const, you can't.

@wbamberg
Copy link
Author

my devtools bugbear

See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1580891

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants