Old 11th January 2012, 11:37   #1
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
Unicode Nsis - Problem reading a xml file

Hi all.
I am trying to build a unicode setup. I have to read some informations from a xml file but in the unicode version i can not do it. I tried to use different plugins like XML plugin(the one i used for the ANSI setup and it works fine), nsisXml and some others. with XML plugin in the unicode version I retrieve instead of my values, other chars(like squares <.< or empty strings). I can't understand why this happend. Xml plugin could support unicode UTF-8.
I attach the code I am using for reading the xml file and the xml file.
PHP Code:
<root>
    <
version vers="myvalue"/>
</
root
PHP Code:
${If} ${FileExists"file.xml"
        
${xml::LoadFile"file.xml" $0
    
        
${xml::FindNextElement"version" $$1                    
    
        
${xml::ElementPath$Path
    
        
${xml::GotoPath"$Path$5
    
        
${xml::GetAttribute"vers" $myvar $2    
    
        
${xml::Unload}
    ${EndIf} 
I can not understand why this code work in ANSI format returning in this example "myvalue" and does not work in UTF-8 returning a square or an empty string.

p.s. I am sorry for my English .-. and i can not find the answer in other threads so i made this...

Thnx in advance
Bennaloz
bennaloz is offline   Reply With Quote
Old 12th January 2012, 04:44   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 566
Send a message via ICQ to T.Slappy
Please clarify which parts are unicode and which not!

If you have UNICODE NSIS you need to have UNICODE plugins (xml plugin)
But the .XML file still may be saved as NON-unicode!
Reading ANSI xml file with Unicode plug-in will be probably fine but reading UTF-8 xml file
may fail even with Unicode plug-in.

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2022: www.visual-installer.com
or RAD Studio 2009 - 11 Alexandria: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 12th January 2012, 06:37   #3
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
Ok for first I am sorry if I am making a stupid question or asking the obvious but I am a beginner in this field and I still don't know how things work. I will try to explain you better what the situation is.
I am using Notepad++ as text editor. I made my non-Unicode setup so in ANSI format. But since I need an Unicode one I thought to convert it in UTF-8 with notepad but compiling it with Unicode NSIS it does not work.
Initially I didn't think about the format of the .xml file but then I tried to convert it to UTF-8 and it didn't work the same so I tried again to ANSI format and the result was the same, I can't read the .xml file.
I am using the XML plugin(nsis.sourceforge.net/XML_plug-in <-- this one) that should support Unicode UTF-8.
I don't understand why I can't read the .xml file.
I hope I was clear explaining the problem.

Thnx again

Last edited by bennaloz; 12th January 2012 at 07:54.
bennaloz is offline   Reply With Quote
Old 12th January 2012, 08:01   #4
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
you don't have to convert the script to unicode, the unicode compiler does this for you. however, you might have to convert your xml file to unicode to make it work with your unicode installer. a2u.exe should do the job!
Yathosho is offline   Reply With Quote
Old 12th January 2012, 09:58   #5
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
Ok T.Slappy said the opposite that is "Reading ANSI xml file with Unicode plug-in will be probably fine but reading UTF-8 xml file
may fail even with Unicode plug-in. "
(And then I was thinking about that a unicode setup should be able to read an ansi and a unicode file because unicode includes also ansi chars if I am not wrong.)
Anyway right now I have no ideas what to do.
If I have to read a .xml file (ansi or unicode) with a unicode setup how can I do it? If I have to convert it to unicode from ansi I was trying Unicode plugin(because I need to convert it runtime) but it seems can't open the file and I don't know why.
bennaloz is offline   Reply With Quote
Old 12th January 2012, 11:15   #6
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
I have just made a new setup. I tried only to load a .xml file that doesn't exist. The return should be a -1 because it doesn't exist but returned a square. So what is the problem? This plugin doesn't support unicode?
bennaloz is offline   Reply With Quote
Old 12th January 2012, 12:06   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Have you extracted the Unicode version of the plug-in (if there is one)?

Stu
Afrow UK is offline   Reply With Quote
Old 12th January 2012, 12:30   #8
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
There is only a .dll file and a .nsh file (related .dll library) (nsis.sourceforge.net/XML_plug-in) this is the plugin I am using... I see the square compiling with unicode NSIS and showing the result with detailPrint or messageBox I don't think that the reason of the square is the way that I show the result. Anyway there is only a plugin in the pack and on sourceforge is write it support unicode UTF-8.
I attached my source. Try to compile it with both NSIS unicode and ansi and you will see the difference. Obviously you must have my xml plugin you find it in the link above. let me know what's wrong if you can.
Attached Files
File Type: nsi testunicode.nsi (159 Bytes, 167 views)
bennaloz is offline   Reply With Quote
Old 12th January 2012, 13:50   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
If you want to use a plug-in with Unicode NSIS you will usually need a Unicode build of that plug-in.

Stu
Afrow UK is offline   Reply With Quote
Old 12th January 2012, 13:53   #10
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
ah yes sure... So do you know some unicode plug-ins to read xml? i'll repeat that this one should be unicode anyway if you know others plugin please tell me maybe one that works...
bennaloz is offline   Reply With Quote
Old 12th January 2012, 15:09   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
http://wiz0u.free.fr/prog/nsisXML/

Stu
Afrow UK is offline   Reply With Quote
Old 13th January 2012, 06:11   #12
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
tested... it gives me a Runtime error when I execute the unicode setup... also using the examples... so it's not a my mistake writing the source... but other problems and I don't know what kind of problems could be
Can I ask someone to make a little example that works and read a .xml file(maybe with wizou's plugin)? Could the OS be the cause of the problem? (I don't think I am using XP)

Last edited by bennaloz; 13th January 2012 at 08:05.
bennaloz is offline   Reply With Quote
Old 13th January 2012, 08:57   #13
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
OK I am noob I make it works now...@afro Thnx for the link you said it works and it works I said that it didn't work because before installing unicode nsis I took only the ansi plugin... anyway thnx for all...
bennaloz is offline   Reply With Quote
Old 13th January 2012, 11:58   #14
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
Anybody know if NsisList plug-in support unicode?
ok never mind I solved by myself

Last edited by bennaloz; 13th January 2012 at 13:46.
bennaloz is offline   Reply With Quote
Old 13th January 2012, 13:54   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
There doesn't appear to be a Unicode build. Did you use a different plug-in instead?

Stu
Afrow UK is offline   Reply With Quote
Old 16th January 2012, 06:36   #16
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
Yes I used nsArray. If I am not wrong you made it.
bennaloz is offline   Reply With Quote
Old 16th January 2012, 11:47   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Correct

Stu
Afrow UK is offline   Reply With Quote
Old 16th January 2012, 15:01   #18
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
At last it's a list managed like an array right? or not? u.u
bennaloz is offline   Reply With Quote
Old 16th January 2012, 20:07   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Yes it uses a linked list of pointers rather than a large allocation of contiguous memory.

Stu
Afrow UK is offline   Reply With Quote
Old 17th January 2012, 06:08   #20
bennaloz
Member
 
Join Date: Jan 2012
Location: Treviso
Posts: 61
yes because otherwise it would be impossible to add/delete elements. anyway thanks a lot again for the help...
bennaloz 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