Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript - Convert string to UTF-16

I am working with Javascript for one of the first times and its for a sha-1 hash. I have found code to do this, but one of its dependencies is a method to convert the string to utf-8, however the server I am comparing against utilizes utf-16. I have looked around and all my results keep showing up w/ utf-8. Can anybody at least point me in the right direction? Thanks.

like image 276
rbucinell Avatar asked Dec 01 '25 01:12

rbucinell


1 Answers

Javascript already uses UTF-16 internally - use charCodeAt() to get the values.

like image 102
Christoph Avatar answered Dec 03 '25 17:12

Christoph