Fix sonar issue, platform dependency on encoding