[Jenkins] Fixed java.nio.charset.UnmappableCharacterException: Input length = 1 on Windows

My Team upgrade Jenkins to Lasted LTS Version 2.361.1. After Upgrade and Test Jenkins on Windows. It shows error as follows Cause Because Jenkins change logic reading JenkinsFile with default encoding Fix `DM_DEFAULT_ENCODING` SpotBugs violations (#6050) · jenkinsci/jenkins@8a5e309 (github.com) Check default charset of the machine by using Method Charset.defaultCharset(); by using this code (Test.java) The System tell me x-windows-874 ….. Change System Environment Variable Add KEY: JAVA_TOOL_OPTIONS VALUE: -Dfile.encoding=UTF8 Restart System & Run Test.java Recap Solution add System Environment Variable KEY JAVA_TOOL_OPTIONS VALUE -Dfile.encoding=UTF8 Restart System Test build Because on It read jenkinsfile by using system default Encoding (Windows =…