Announcement

Collapse
No announcement yet.

Unicode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unicode

    Jim Park has issued a patch to add Unicode support to NSIS. Currently it's a completely different build that can create nothing but Unicode installers (no Windows 9x support).

    Please help me test it for speedier integration.



    You can download a pre-built version from:

    NSIS FAQ | NSIS Home Page | Donate $
    "I hear and I forget. I see and I remember. I do and I understand." -- Confucius

  • #2
    Thanks for posting that kichik.

    A few things to note. The Unicode NSIS installer is COMPLETELY Unicode. This means that your NSI script must also be Unicode (UTF-16LE). This can easily be done by using Notepad. Just change the encoding to "Unicode" and that will do it.

    Note that the plugins you may be relying on will not work unless they are also built with Unicode in mind. This means that the access to the global stack that is used to transmit information back and forth from plugin to NSIS must contain Unicode (wchar_t) strings.

    *** Developers ***
    If you are a plugin author, it shouldn't be too difficult to make the changes. You can take a look at what I did for the standard plugins that ship with NSIS. The source is here:



    If you look at ExDLL, you will notice new functions that will help you with the translation of the stack as well. For instance, if you DLL only cares about ASCII codesets, then you may not need to do much modifications at all. It just needs to call the new functions that automatically translate the stack's strings from Unicode to ANSI and ANSI to Unicode. But most likely, if you are dealing with user entered strings, you will need to make your DLL completely Unicode aware as well.

    The source uses TCHARs so you can target building both ANSI and Unicode versions of NSIS. It is based on NSIS 2.29 with some bug fixes and minor tweaks. If you are interested, the ANSI version of the binary built with the same source code is also here:



    Please look at the tracker submission for more information about building the source yourself. I developed on VS2005 and I would be surprised if it builds on the other platforms. Even if they do, I did not change the SCONS config files for the other platforms to define _UNICODE and UNICODE which is what's needed for the source to be built as Unicode.
    Unicode NSIS advocate -- http://www.scratchpaper.com for latest build and source.

    Comment


    • #3
      Source code link:



      ANSI version link:

      NSIS FAQ | NSIS Home Page | Donate $
      "I hear and I forget. I see and I remember. I do and I understand." -- Confucius

      Comment


      • #4
        Is this will affect future versions? I mean I'm not a UNICODE fan, but if is it going to be...

        * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
        * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.

        Comment


        • #5
          Well, the niceness of this approach is that those who want the ANSI version for Win95/98/ME compatibility can use the ANSI version. For those who need support of languages that only Unicode can provide can use the Unicode version. It gives you a choice. And we can give you that choice with one code base.
          Unicode NSIS advocate -- http://www.scratchpaper.com for latest build and source.

          Comment


          • #6
            I have just adapted my installer to use this unicode version for a russian language installer, and everything seems fine in russian except for some reason the welcome page has loads of question marks instead of the correct characters of the introduction text. It's weird because all the other panels are fine. Does anyone know what is going on here?

            Cheers,

            Hayden Devlin

            Comment


            • #7
              The introduction text should ALSO be Unicode. So open it up in Notepad and then save as Unicode encoding. That should work. So remember EVERYTHING must be Unicode. If you have an ASCII file, you need to make sure it's now UNICODE. Hope this helps.
              Unicode NSIS advocate -- http://www.scratchpaper.com for latest build and source.

              Comment


              • #8
                Sounds great. One quick question: what happens when one of these builds gets run on 9x? Is it possible to detect in .onInit and show a MessageBox to the user, or would it just crash immediately? If the latter, then I guess the build could be wrapped by a non-Unicode build that does this detection and messaging.

                Comment


                • #9
                  Originally posted by dienjd
                  Sounds great. One quick question: what happens when one of these builds gets run on 9x? Is it possible to detect in .onInit and show a MessageBox to the user, or would it just crash immediately? If the latter, then I guess the build could be wrapped by a non-Unicode build that does this detection and messaging.
                  I decided to not be so lazy and just try for myself. I compiled Examples\bigtest.nsi and tried it on Windows 98. It crashed immediately, which is expected. However, there are ways to gracefully handle this, as I mentioned in my last post.

                  Comment


                  • #10
                    how about Microsoft Layer for Unicode on Win95/98/ME (MSLU)?



                    sounds easy to integrate.
                    hand by [email protected]
                    ----------
                    WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility

                    Comment


                    • #11
                      yeah, but you have to ship the MSLU dll along with the installer
                      IntOp $PostCount $PostCount + 1

                      Comment


                      • #12
                        well, at least nsis may get compiled against mslu, so it still works normal on win2k/xp/vista, but also MAY work on win95/98/me IF the user has mslu installed.
                        hand by [email protected]
                        ----------
                        WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility

                        Comment


                        • #13
                          When converting ANSI files to Unicode, I've noticed that the conversion works fine with Notepad, but converting using Textpad or the iconv program on FreeBSD results in the Unicode file not working with Unicode NSIS.

                          While testing this patched version of NSIS, I want to be able to automatically convert files as part of a build process instead of maintaining separate copies of the same files but just in different encodings. Notepad doesn't seem to have a command line interface other than 'notepad.exe filename.txt'. I guess I could make something that launches Notepad and hooks the window to do a Save As

                          This isn't a big deal, but it would be nice to have. Anyone have ideas on how to do this other than the ugly window hooking method?

                          Comment


                          • #14
                            There are a few possible reasons. The first is conversion to a wrong charset. Even Unicode has multiple charsets available. Make sure you convert to UTF-16LE.

                            Another reason could be a missing BOM. Try perpending the file content with FF FE (the actual bytes, not text).
                            NSIS FAQ | NSIS Home Page | Donate $
                            "I hear and I forget. I see and I remember. I do and I understand." -- Confucius

                            Comment


                            • #15
                              My thoughts are exactly the same as kichik's. Here's a little utility I wrote called a2u.exe that converts an ANSI codepage text file to Unicode. You provide what codepage to use. So it can be run regardless of your OS codepage setting. So this will fit your bill in making this whole process automated. (I didn't convert all the include files, example, etc., by hand, you know?) It should also be helpful in converting your current NSIS scripts to Unicode as well.

                              I included the source as well so you can modify it to work anyway you want.

                              Look in http://www.scratchpaper.com/a2u.zip or I'm attaching the file here as well.

                              Enjoy.
                              Attached Files
                              Unicode NSIS advocate -- http://www.scratchpaper.com for latest build and source.

                              Comment

                              Working...
                              X