I think the concern on how people seeing what they see can be understood
from JS is more than valid ...

```js
var foo = '𝐀';
var bar = 'Й';
foo.length; // 2
Array.from(foo).length // 1

bar.length; // 2
Array.from(foo).length // 2
```

Why is that and how to solve?


On Wed, Apr 1, 2015 at 10:32 PM, Mathias Bynens <[email protected]> wrote:

> On Wed, Apr 1, 2015 at 10:30 PM, monolithed <[email protected]> wrote:
> >> What you’re seeing there is not normalization, but rather the string
> >> iterator that automatically accounts for surrogate pairs (treating them
> as a
> >> single unit).
> >
> > ```js
> > var foo = '𝐀';
> > var bar = 'Й';
> > foo.length; // 2
> > Array.from(foo).length // 1
> >
> > bar.length; // 2
> > Array.from(foo).length // 2
> > ```
> >
> > I think this is strange.
> > How to safely work with strings?
>
> It depends on your use case. FWIW, I’ve outlined some examples here:
> https://mathiasbynens.be/notes/javascript-unicode
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to