cherry_pie
7 years agoOccasional Contributor
SoapUI | Groovy script | Cyrillic encoding in the file
Hello!
I have projectDir file with Cyrillic letters. Groovy Script set this letters from projectDir file to SoapUI properties, but when they are installed, they become unreadable. It's encoding problem, but I do not know what encoding is used in properties.
File content:
NameOfOrganization=Привет
Groovy Script:
import com.eviware.soapui.support.GroovyUtils;
// ==== Prepare properties for reading ==== //
def groovyUtils = new GroovyUtils(context);
def projectDir = groovyUtils.projectPath;
log.info "projectDir: " +projectDir
def props = new Properties();
new File(projectDir, "InstallAPs.txt").withInputStream {
stream -> props.load(stream);
}
def NameOfOrganization =String.valueOf(props["NameOfOrganization"])
testRunner.testCase.setPropertyValue("NameOfOrganization", NameOfOrganization)
Result: