Old 2nd April 2018, 11:37   #1
alexmitev
Junior Member
 
Join Date: Feb 2017
Posts: 19
${StrRep} and Unicode

Hello,
I'm using the code for the ${StrRep} function taken from http://nsis.sourceforge.net/StrRep in a separate nsh file.
The problem is, when I use
code:
Unicode true

I get error
HTML Code:
Can't change target charset after data already got compressed or header already changed!
I see the function is doing nothing special. How can I resolve this issue?

Regards,
Alex
alexmitev is offline   Reply With Quote
Old 2nd April 2018, 12:16   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,888
Put the Unicode attribute at the start of your .nsi

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd April 2018, 13:55   #3
alexmitev
Junior Member
 
Join Date: Feb 2017
Posts: 19
Yes, this is obvious, but I was looking for a more elegant solution. How can several Exch and Push commands mess up compression?
alexmitev is offline   Reply With Quote
Old 2nd April 2018, 17:30   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,888
Once you start adding code to a section/function the Unicode mode is locked. Technically I believe you can do Push "" etc. but once a non-empty string is used the mode is locked.

You must put code in a macro if you want to delay something.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 2nd April 2018, 18:46   #5
alexmitev
Junior Member
 
Join Date: Feb 2017
Posts: 19
Yes, you're right, even this code produces the error:

code:
Function blah
Push $R0
FunctionEnd
Unicode true



even if I use the function at a much later state...
alexmitev is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump