INetC ограничен UTF-16LE и активной кодовой страницей Ansi. Возможно, можно добавить переключатель /UTF8DATA
, но в то же время вы должны поместить данные сообщения в файл:
!include LogicLib.nsh
Function WriteStringAsUTF8ToFile
Exch $1 ; File path
Exch
Exch $2 ; NSIS string & File handle
Push $0
Push $3 ; UTF-8 string buffer
System::Call 'KERNEL32::WideCharToMultiByte(i65001,i0,wr2,i-1,p0,i0,p0,p0)i.r0'
${If} $0 = 0
fail_simple:
StrCpy $1 ""
${Else}
System::Call '*(&i$0)p.r3'
${IfThen} $3 P= 0 ${|} Goto fail_simple ${|}
System::Call 'KERNEL32::WideCharToMultiByte(i65001,i0,wr2,i-1,pr3,ir0,p0,p0)'
IntOp $0 $0 - 1 ; Don't write the terminator
FileOpen $2 $1 w
${IfThen} $2 == "" ${|} Goto fail ${|}
System::Call 'KERNEL32::WriteFile(pr2,pr3,ir0,*i,p0)i.r0'
${IfThen} $0 = 0 ${|} StrCpy $1 "" ${|}
FileClose $2
Goto done
fail:
StrCpy $1 ""
done:
System::Free $3
${EndIf}
Pop $3
Pop $0
Pop $2
Exch $1
FunctionEnd
Section
InitPluginsDir
Push "${U+2115}SIS" ; String to write as UTF-8
Push "$PluginsDir\data.txt"
Call WriteStringAsUTF8ToFile
Pop $0
${If} $0 == ""
MessageBox mb_ok "Error: Unable to write post data to file!"
${Else}
inetc::post $0 /FILE /TOSTACK "http://example.com/post" "" /END
Pop $1 ; "OK" on success
Pop $2
MessageBox mb_ok "Result: $1$\nResponse: $2"
${EndIf}
SectionEnd