Old 27th July 2007, 19:04   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Xml & Utf-16

I've tried Instructor's XML plug-in and it does not support XML files encoded in UTF-16. I'm not particularly on the ball with this, so does anyone know of a way to modify the file?

I seem to be able to read bytes from it that are readable characters but writing to it is another matter using FileWriteByte.

Stu
Afrow UK is offline   Reply With Quote
Old 27th July 2007, 20:46   #2
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
If the characters all map into 8 bit characters, you can use Notepad to convert from 16 bit unicode to ansi. Change the encoding dropdown in the file-save dialog to convert the file.

Don
demiller9 is offline   Reply With Quote
Old 27th July 2007, 21:12   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Sorry, should have said, this needs to be done at run-time automatically. I've found some programs to convert from UTF-16 to UTF-8 but they aren't working under nsExec for some reason. Still testing.

The scenario:
Convert UTF-16 file to UTF-8.
Modify it with the XML plug-in.
Convert it back to UTF-16.

Stu
Afrow UK is offline   Reply With Quote
Old 27th July 2007, 22:33   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I ended up using NSIS FileOpen, FileRead, FileWrite and FileClose to make my changes to the XML file! The XML plug-in seems to lack some of the features/functions that DOM manipulation in JavaScript has.

Stu
Afrow UK is offline   Reply With Quote
Old 27th July 2007, 23:32   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Still not working correctly. The command-line tool converts it to UTF-16 BE when it needs to be UTF-16 only. The program that uses the XML file now crashes!

Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2007, 00:17   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Hit gold, with this:
http://scripts.sil.org/cms/scripts/p...&cat_id=TECkit

Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2007, 05:04   #7
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
[deleted]
Instructor 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