rejetto forum

passing utf-8 characters in hfs.tpl function

newbie · 4 · 4720

0 Members and 1 Guest are viewing this topic.

Offline newbie

  • Occasional poster
  • *
    • Posts: 39
    • View Profile
Hi,
I created a simple function like below which exec's an external application.
It takes 2 utf-8 arguments. I've noticed that the args show up with ???? chars for the utf-8 characters in the Powershell script.
I've tried changing the active code page in the PS1 script by adding chcp 65001 and Input/Output encoding to UTF-8, but makes no difference.

However, if I change the active code page for the machine by changing this registry entry and then RESTARTING windows..
Code: [Select]
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP 65001it sends utf-8 characters into the PS1 script.

Is there anyway to do this, without changing the active page of the machine & restarting?


Code: [Select]
[ajax.foo|public|no log]
{.check session.}
{.set|x|{.postvar|var1.}.}
{.set|y|{.postvar|var2.}.}
{.exec|powershell.exe -F foo.ps1 "{.^x.}" "{.^y.}"|out=#output.}
{.^#output.}



Offline newbie

  • Occasional poster
  • *
    • Posts: 39
    • View Profile
Looking at the 2.4.0 rc07 src:
utillib.pas Line 1238:
Code: [Select]
result:=(cmd > '') and (32 < shellexecute(0, 'open', pchar(cmd), pchar(pars), NIL, showCmd)
Should this be:
Code: [Select]
result:=(cmd > '') and (32 < shellexecuteW(0, 'open', pwidechar(cmd), pwidechar(pars), NIL, showCmd)


Offline newbie

  • Occasional poster
  • *
    • Posts: 39
    • View Profile
I compiled 2.4.0rc07 and I can confirm that w/ the below change, I'm seeing utf-8 values in my arguments inside the Powershell script.

2.4.0 rc07 src:
utillib.pas Line 1238:
Code: [Select]
result:=(cmd > '') and (32 < shellexecuteW(0, 'open', pwidechar(cmd), pwidechar(pars), NIL, showCmd)