Archive: UTF-8 scripts


UTF-8 scripts
i figured that utf-8 scripts (like scripts containing Chinese, Japanese, Korean) don't compile, since one has to remove the "" at the very beginning of the document. maybe nsis should ignore that, so one does not have to edit the script each time it's been saved.


NSIS does not use Unicode, because it is not supported by Win9x.


you could just have a small program that processes the file beforehand to convert the file into ansi so nsis can cope with it.

you could use a richedit v2 control to load the file and then save it out as a normal text file. not the best of ideas since some of the extra characters (especially for languages that need it) would be lost but it would give you a useable file :)

-daz


had a few minutes to kill and knocked up this.

the program will convert a unicode file to ansi (not exactly sure how things will be mapped with files that fully use extended characters) and it requires riched20.dll (richedit v2+ basically on most machines now - checks for this on init).

usage: create a shortcut to the test program (for the moment) and add the file to convert onto the end of the target string.

at the moment it will output to 'convert.nsi' but will increase the features for tomorrow (only spent 30 minutes on it ;) )

-daz


Why would you use richedit to do this conversion? It isn't really something you should use for conversion.

You can convert text to ANSI using any text editor like Notepad.


i know it's not the best method to use for conversion but it's just doing the same as a text editor would do (though notepad on my win98 system can't do that conversion).

thought it would be useful to have a simple conversion from a unicode file to ansi which is automatically done, nevermind :(

-daz


Why not use WideCharToMultiByte?


hadn't considered that until Joost posted. thought the richedit idea was a simple way to do it since from what i understand it will convert things using WideCharToMultiByte internally (so it will cope with displaying in the ansi version of the richedit control).

-daz


All NT versions of Notepad support this convertion. Because Win9x doesn't support Unicode, it's unlikely that anyone using Win9x would product Unicode files.

If you want to convert a file, you'd better use standard Windows API than a RichEdit control (which is designed to display data).


oops, should have realised that. using the api's does make more sense now i've had it pointed out, just not sure why i didn't think about it earlier. (feel very stupid now but thank you for pointing things out)

-daz


taking comments made earlier i had a go at using the WideCharToMultiByte and this is what i've done.

When calling it just pass the filename to read and the file to save to and if all is fine it will generate a ansi version of the file (will indicate errors via messageboxes at the moment).

The file paths need to be full paths and if they are long names then it is advisable to put quotes around the path ("c:\blah blah.log").

It will also check before conversion to see if the file is unicode or not (which is sensible).
It currently won't strip out the unicode file indicator from the start if there is one (hence the wierd character at the start of converted files)

Slightly off topic, it could be useful for makensisw to have the ability to run a preprocessing script/program (like vc++, etc can do). Just a thought

-daz


Win9x doesn't need to support unicode because of MSFT's Unicode Layer. I have asked several developers who are familiar with coding w/ unicode and they all say that it is no where near as difficult and daunting a task as most developers think it is.

-wow..I can't type :p


Then NSIS would have to include huge and buggy Win9x Unicode libraries, which will make your installer more than 10 times larger.


Dunno, maybe. But the dll itself is < 245k. Maybe that is 10 times larger..hm. dunno how big NSIS is but still..


The NSIS exehead is only 34 KB large. Supporting this buggy library would require lots of work, we would have to create sepeate Win9x/NT code and include the library which is almost 10 times larger than the installer itself.

So it is not possible to support it. However, NSIS does support MBCS so you can still use all languages.