Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old October 24, 2019, 09:24   #21
Gauss
Apprentice
 
Gauss's Avatar
 
Join Date: Aug 2018
Location: Barcelona
Posts: 76
Gauss is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
Pretty common actually--I was guessing BOM too, but according to the notepad++ docs, the default encoding is supposed to apply only to new docs, not existing ones. In retrospect, I suspect what happened is that 'save as' is interpreted as a new doc.
Notepad normally uses ANSI encoding, so if it reads the file as UTF-8 then it has to guess the encoding based on the data in the file. If you save a file as UTF-8, Notepad will put the BOM (byte order mark) EF BB BF at the beginning of the file. Notepad makes an educated guess i think.
Gauss is offline   Reply With Quote
Old October 24, 2019, 10:53   #22
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,077
wobbly is on a distinguished road
Nice, glad someone who knows more about these things got there first.

Quote:
Originally Posted by Pete Mack View Post
Pretty common actually--I was guessing BOM too, but according to the notepad++ docs, the default encoding is supposed to apply only to new docs, not existing ones. In retrospect, I suspect what happened is that 'save as' is interpreted as a new doc.
In preferences, new document, encoding. the default is UTF-8 with a little tick box "Apply to open ANSI files" defaulting to on. Presumably if you hit save as it will save it in UTF-8.
wobbly is offline   Reply With Quote
Old October 26, 2019, 18:31   #23
Tibarius
Swordsman
 
Tibarius's Avatar
 
Join Date: Jun 2011
Location: Germany
Age: 50
Posts: 399
Tibarius is an unknown quantity at this point
some more information for users with windows operating systems

Some more details eventually interesting for window users:
An unzipped Angband text file in /lib/gamedata (version 4.1.3)
has a disc size of 4096 or a multiple, so the operating system used to create the zip file most likely uses a block write / read disc driver functionality (because it is much faster than reading/writing single chars).

Example: p_race.txt has a size of 4621 bytes, and a disc size of 8192 bytes

The text files have no Byte order Mark, they are encoded in the ANSI text format. So if you want to modify them, make sure you save with ANSI encoding.

Wordpad: does that automatically
Editor: you can choose the type (ANSI / unicode / UTF-8) if you Save as
Notepad++: requires to be set to ANSI (even if you open an ANSI file with notepad ++ the predefined save option is UTF-8 encoding)

The Editor has some kind of problems saving monster.txt in ANSI encoding, afterwards Angband comes up with an parse error. The size of the file changed, but i didn't bother to analyze what exactly changed.

Also noteable ... the original files use Hex '0A' (decimal 10) as Newline character. So opening with an Editor that does not add a '0D' carriage return to it (for example the simple Editor) will render the file almost unreadable, because the number of chars per line is 1024 in that case.

Notepad++ can handle this format and shows readable lines. And even if you save it in ANSI format, there are still only 0As as end of line characters.

Wordpad does add an hex '0D' character at the end of each line. In the case of p_race.txt the file size increases to 4879 bytes.

Angband application can parse both 0A alone as well as 0D 0A.

Conclusion: Best editor of those 3 for me is notepad++, does not change file size by addind 0D chars, has line numbers and you can choose which encoding to use if you save the file. The only drawback, it always uses UTF-8 as predefined encoding, even if you open an ANSI encoded file.
__________________
Blondes are more fun!
Tibarius is offline   Reply With Quote
Reply

Tags
error, modding, modifying


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modifying Artifacts - Parse error? philly1919d Vanilla 9 November 23, 2017 09:36
Reusing the Angband parser Byrhtnoth Development 12 March 17, 2017 05:43
Error in monsters description TJS Development 4 July 31, 2010 14:00
Lua "obsolete file error", blargh Therem Harth ToME 4 July 4, 2010 15:02
File Dump Error Batanu44 Vanilla 2 October 13, 2009 01:01


All times are GMT +1. The time now is 11:58.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.