Re-encode a string in the code from the UTF-8 encoding to windows-1251

Perhaps you can help me with one trial?

The fact is that on the Katalon website there is a known problem with transcoding, when running test-cases through the console:

“Katalon Studio Console mode can not display Unicode characters because Windows CMD does not support UTF-8 encoding.”

At the moment I’m trying to re-encode a string in the code from the UTF-8 encoding to windows-1251:

def TestName = ‘ResultCodeDescription [0]. Description’

def Test = ‘Переданы не все параметры’

on which, then verification occurs:

WS.verifyElementPropertyValue (responseData, ExpectTestName, ExpectTest).

The problem arose in the following.

Katalon is able to transcode the response from the service and can respond with a given value.

When you try to pass this case, running through the console, the CMD window does not know how to recode.

In this case, I want the string:

def Test = ‘Переданы не все параметры’

was transmitted for verification in the windows-1251 encoding, that would be correct when verifying the response from the service when launching the test case through the console.

Probably someone faced such problem ??

1 Like

Up. I have the same problem =/

  1. Set your windows system environment variable
    key : JAVA_TOOL_OPTIONS
    value : -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8
  2. verify your cmd data

If I have a variable with letters like ä,ü,ö I receive the error:

javax.mail.MessagingException: A4 BAD Could not parse command;
  nested exception is:
	com.sun.mail.iap.BadCommandException: A4 BAD Could not parse command

I want to search for subject lines in google mail via api

Solution:

byte[] data = this.subjectSearchTerm.getBytes(StandardCharsets.UTF_8)
String encoded_subjectSearchTerm = new String(data, StandardCharsets.ISO_8859_1)

We now can search in Google for äöü but still have a problem with &. Any ideas about symbols like these?