3 ms·
UTF-8 takes 8 bits for most characters It should be noted that "most" here presumably means "most characters in an average English or western/central European
by pmjordan 16y ago
UTF-8 takes 8 bits for most characters
It should be noted that "most" here presumably means "most characters in an average English or western/central European language text" as out of the ~2^21 (~2 million) Unicode code points, only 128 are represented using 8 bits in UTF-8.
- pornel 16y agoIt doesn't matter. Whenever ASCII is an option, UTF-8 is optimal too. ASCII is not an option for languages other than average English with poor typography and inability to deal with foreign names and addresses (e.g. LinkedIn made horrible mistake of using Latin1 initially. I still have contacts with &xxxx; visible in their names). I think node.js should use UTF-8 by default, and require users to consciously switch bottleneck parts of their apps to ASCII.
- pmjordan 16y agoI wasn't stating my opinion in my last post, just facts/clarifications. But yes, I agree that UTF-8 would be a better default than ASCII unless someone provides hard evidence that encoding/decoding is a severe performance bottleneck in most real applications. (even then, I'd default to the "correct", not the fastest)