Forum Discussion

cherry_pie's avatar
cherry_pie
Occasional Contributor
6 years ago

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:


 

  • avidCoder's avatar
    avidCoder
    Super Contributor

    Go to this path:-

    SOAPUI_HOME/bin and then edit soapui-5.4.0.vmoptions and below line

    -Dfile.encoding=UTF-8

     Save it and restart soapui again. You will see the changes in soapui->Help -> System properties.