crypto-js Error: Malformed UTF-8 data [How to Solve]

Crypto js Malformed UTF-8 data

Note: If your application is started by jar package, please refer to solution 1; If your application is started by tomcat, please refer to solution 2.

Solution 1: jar package startup configuration

 java -jar -Dfile.encoding=utf-8 itemapi-1.0.1.jar

Solution 2: tomat configuration

Set up in Tomcat’s catalina.bat.

set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% -Dfile.encoding=UTF-8"

Read More: