cancel
Showing results for 
Search instead for 
Did you mean: 

Using Unicode with Recorder.AddSyntaxToScript

Highlighted
Occasional Contributor

Using Unicode with Recorder.AddSyntaxToScript

I have written my own record action (as script extension) to handle certain cases during test recording. The implementation of the record action uses `Recorder.AddSyntaxToScript` to add operations to the test being recorded. Unfortunately I noticed that this function is unable to handle Unicode correctly.

 

Example (very much simplified): 

 

function RecordExecute_CurrentControl_JS()
{
  var call;
  call = Syntax.CreateInvoke();
  call.ClassValue = 'BuiltIn';
  call.InvokeName = 'MessageDlg';
  call.IsProperty = false;
  call.AddParameter('‰Šš›‹žŽŸŒœ•€'); 

  Recorder.AddSyntaxToScript(call);      
}

 

This will end up in my keyword test as follows:

 

BuildIn    | MessageDlg    | "\\u2030Šš\\u203a\\u2039žŽŸŒœ\\u2022€" 

 

 

Is there any method I need to call on my string parameter to prepare it for `AddSyntaxToScript`?

 

P.S.: Recorder.AddTextToScript works just fine with any Unicode-String passed.

5 REPLIES 5
Highlighted
Community Leader

Re: Using Unicode with Recorder.AddSyntaxToScript

so it works well because you get the good utf encoding. When you run it's not working ?

Un sourire et ça repart

Highlighted
Occasional Contributor

Re: Using Unicode with Recorder.AddSyntaxToScript

No, the given example does not work as expected. It displays a message box containing "\u2030Šš\u203a\u2039žŽŸŒœ\u2022€" and not my string passed from the JavaScript code. Thus the string is not interpreted correctly. Also the string ist not correctly displayed inside the keyword test editor.

 

If I add operations using `AddTextToScript`, any unicode characters are displayed correctly inside the keyword test editor and also during execution of the test. 

Highlighted
Community Leader

Re: Using Unicode with Recorder.AddSyntaxToScript

I dont know if in KWT you have to play with Project options Unit encoding ? (Tools / current project properties / General / Unit encoding). Perhaps try it ?

Un sourire et ça repart

Highlighted
Community Manager

Re: Using Unicode with Recorder.AddSyntaxToScript

Thank you for helping out here Benoit!

 

@easy-soft did the advice help you solve the issue?


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Highlighted
Occasional Contributor

Re: Using Unicode with Recorder.AddSyntaxToScript

No, unfortunately the encoding of the script files does not change the behaviour. It is set to UTF-8. As I've already stated, AddTextToScript works fine and AddSyntaxToScript in the same script function does not.

Tags (1)
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors