Showing results for 
Search instead for 
Did you mean: 

Using Unicode with Recorder.AddSyntaxToScript

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;



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.

Community Leader

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

Un sourire et ça repart

Occasional Contributor

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. 

Community Leader

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

Community Manager

Thank you for helping out here Benoit!


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

Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Occasional Contributor

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:
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file


How to execute remote test and obtain results via Test Runner REST API

Top Kudoed Authors