localeCompare yields different results in different Node.js versions, and I am trying to find out exactly why this is happening.
Specifically, Node 12.22.12 vs 13.0.0
$ nvm use 12.22.12
Welcome to Node.js v12.22.12.
Type ".help" for more information.
> "topic".localeCompare("топик", "ru")
-1
$ nvm use 13.0.0
Welcome to Node.js v13.0.0.
Type ".help" for more information.
> "topic".localeCompare("топик", "ru")
1
Didn't find anything in the Nodejs changelogs from 12 and 13
Only thing I could find was maybe this change in v8 engine on version 7.6, however, when I check the v8 version in the node 12.17.0 console, i get:
> console.log(process.versions.v8)
7.8.279.23-node.37
Which is higher than 7.6, so it can't be that v8 change.
So, what's causing Node 12.22.12 and Node 13.0.0 to yield different results when running
"topic".localeCompare("топик", "ru")
?
Note: running these locally on a Mac, but seeing same results in our Linux CI
localeCompare
is usually handled by ICU, so ICU updates in node would be relevant changes to look out for. Perhaps this one from 13.0:
• build:
◦ Node.js releases are now built with default full-icu support. This means that all locales supported by ICU are now included and Intl-related APIs may return different values than before (Richard Lau) #29887.
That's just a guess though.