|
|
|
|
#1 |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
[Help] Regarding Reading/Writing Unicode Files
I was just wandering if there was a possibility to Find and replace strings within a Loaded Unicode File from a ANSI NSIS.
I want to replace the string found with a bunncha big content... or could i import a File(Content) to be replaced with? |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Aug 2007
Location: Paris, France
Posts: 304
|
Take a look at my nsisFile plugin.
You can use it to search and replace any sequence of bytes. In your case, make sure you specify a sequence of bytes that represents Unicode characters (like 480065006C006C006F00 for "Hello") Use bin version for ANSI NSIS (binU version is for Unicode NSIS) My NSIS plug-ins: http://wiz0u.free.fr/prog/nsis.php |
|
|
|
|
|
#3 |
|
Member
Join Date: Nov 2009
Posts: 52
|
Or you can try this plug-in !
It's based on the original textreplace plug-in by Instructor but can deal with utf-16LE files. We have used the replace function for a while now in several projects, but never done much testing on the find function Just set option /U=1 for UTF-16LE, see the readme for additional details ! |
|
|
|
|
|
#4 | |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
Quote:
I used UNICODE PLUGIN. Unicode(UTF-16LE) -> ANSI Failed. So i decided to convert UTF-16LE -> UTF-8 and UTF-8 -> ANSI and worked. And used text replace on it. ![]() Thank you anways. Will try the new plugin now. |
|
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
Quote:
|
|
|
|
|
|
|
#6 | ||
|
Member
Join Date: Nov 2009
Posts: 52
|
You confuse me...
Quote:
PHP Code:
Quote:
Could you send (part of) the script your using |
||
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
${textreplace::FillReadBuffer} "$INSTDIR\update\modder\resource\l4d360ui_info.txt" $0
${textreplace::ReplaceInFile} "$INSTDIR\update\modder\resource\l4d360ui_tu_english.txt" "$INSTDIR\update\modder\resource\l4d360ui_tu_english.txt" "// -- End Game Lobby Changes" "$0" "/U=1 /PO=1" $1 ${textreplace::FreeReadBuffer} "$0" ${textreplace::Unload} ;------------------------------------------------- ${textreplace::FillReadBuffer} "$INSTDIR\update\modder\resource\ui\l4d360ui\bloginfo.txt" $0 ${textreplace::ReplaceInFile} "$INSTDIR\update\modder\resource\ui\l4d360ui\blogpost.txt" "$INSTDIR\update\modder\resource\ui\l4d360ui\blogpost.txt" "***text02" "$0" "/U=1 /PO=1" $1 ${textreplace::FreeReadBuffer} "$0" ${textreplace::Unload} ;------------------------------------ EOF I tried the ANSI Plugin with newtextreplace.nsh, it didn't replace the file content i needed in the unicode file infact it put some Chinese characters. |
|
|
|
|
|
#8 |
|
Member
Join Date: Nov 2009
Posts: 52
|
I would need the actual text files you are using, to reproduce this.
Could you please zip them up and supply a link ? |
|
|
|
|
|
#9 | |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
Quote:
I repeat, i try to implement a whole content of a file(ANSI text file) in these unicode text Files. |
|
|
|
|
|
|
#10 |
|
Member
Join Date: Nov 2009
Posts: 52
|
There you go, it would basically be impossible to implement a whole content of an ANSI text file into a unicode text Files. You would end up with 'Chinese' characters
. I suggest you to re-code the ansi text file to unicode first.As soon as I find some time I will have a look into it as well |
|
|
|
|
|
#11 | |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
Quote:
awright, i will try using unicode to unicode Writing. Thank you ![]() Edit: Even Unicode to unicode failed
|
|
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
I even tried to
ReadBuffer from a unicode file and paste it over an Unicode file. it copies few texts and fonts change to something else. Donot know what to do-.- |
|
|
|
|
|
#13 |
|
Member
Join Date: Nov 2009
Posts: 52
|
Sorry about this (I'm still learning C ). What I done wrong is that it was taking the string length from the handle number, instead of the text file in the buffer.
As well I fixed a bug what was including the BOM into the ReadBuffer, which then ended up in the middle of your resulting text file. We never used anything else than just replacing basic strings, so I never realized these bugs. Anyway, it should be fixed now
|
|
|
|
|
|
#14 | |
|
Junior Member
Join Date: Jul 2010
Posts: 21
|
Quote:
|
|
|
|
|
|
|
#15 |
|
Member
Join Date: Nov 2009
Posts: 52
|
Gani, forgot about you..
FYI, I totally rewrote the newtextreplace plugin and now there is no problem anymore to replace in one encoding with another encoding. Also the issue with case-insensative for non-ansi characters is solved.
So no more chinese letters for you ![]() http://forums.winamp.com/showthread....newtextreplace please let me know if you have any issues with the plug-in. regards |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|