luci-base: cbi.js: fix sfh() hash calculation over multibyte sequences
authorJo-Philipp Wich <jo@mein.io>
Mon, 19 Nov 2018 10:47:18 +0000 (11:47 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 19 Nov 2018 10:50:25 +0000 (11:50 +0100)
commit2babc47ae2562cc123ea9048197996a0e3a223b1
tree460579e839a0ac4da08390dd8b06c2d91baeac1c
parent1ca5a99a49c515d4bab61220893961445ce9653f
luci-base: cbi.js: fix sfh() hash calculation over multibyte sequences

The C side implementation of the hash operates on bytes while the JS variant
operated on UTF-16 codepoints, leading to miscalculations on input strings
containing multibyte sequences.

Recode the given string to an internal UTF-8 byte representation and
calculate the hash over that.

Fixes client side mapping of translation strings containing non-ASCII
characters.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js