replikativ / hasch

Cross-platform (JVM and JS atm.) edn data structure hashing for Clojure.
Eclipse Public License 1.0
111 stars 13 forks source link

Fix UTF-8 conversion in cljs #13

Closed mikekap closed 4 years ago

mikekap commented 4 years ago

This fixes the issue of emojis (and other higher unicode plane glyphs) not being transformed into utf-8 correctly, and hence giving the wrong hash. For existing users, there is a backwards compatibility escape hatch *use-legacy-utf8-conversion* that can be set to revert to the old algorithm in case any of those hashes have been stored without the ability to rehash.

The new approach works for any modern version of cljs, but if you use google closure < 2016 there used to be a bug - https://github.com/google/closure-library/issues/470 . It's not obvious, but it looks fixed as of Dec 2, 2015.

whilo commented 4 years ago

Thank you! That was quick :). Our automatic test setup does not seem to work anymore with phantomjs, what do you normally use?

mikekap commented 4 years ago

To test this I ended up using figwheel and testing via the chrome console :-/. doo is a pretty good test runner for cljs but it requires karma which means npm. I didn't want to jump through those hoops locally but it might make sense for ci.