jakkn / nwn-devbase

Command line tool used to version control NWN module development
37 stars 17 forks source link

Possible issue converting UTF-8 to WINDOWS-1252 #24

Closed urothis closed 5 years ago

urothis commented 5 years ago

Traceback (most recent call last):
        36: from /usr/local/bin/nwn-gff:23:in `<main>'
        35: from /usr/local/bin/nwn-gff:23:in `load'
        34: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/bin/nwn-gff:214:in `<top (required)>'
        33: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff.rb:143:in `write'
        32: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff.rb:45:in `dump'
        31: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:13:in `dump'
        30: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:13:in `new'
        29: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:33:in `initialize'
        28: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:51:in `write_all'
        27: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `write_struct'
        26: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `each'
        25: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `block in write_struct'
        24: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each_with_index'
        23: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each'
        22: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:157:in `block (2 levels) in write_struct'
        21: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `write_struct'
        20: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `each'
        19: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `block in write_struct'
        18: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each_with_index'
        17: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each'
        16: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:157:in `block (2 levels) in write_struct'
        15: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `write_struct'
        14: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `each'
        13: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `block in write_struct'
        12: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each_with_index'
        11: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each'
        10: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:157:in `block (2 levels) in write_struct'
         9: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `write_struct'
         8: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `each'
         7: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `block in write_struct'
         6: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each_with_index'
         5: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:156:in `each'
         4: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:157:in `block (2 levels) in write_struct'
         3: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `write_struct'
         2: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:112:in `each'
         1: from /var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:168:in `block in write_struct'
/var/lib/gems/2.5.0/gems/nwn-lib-0.6.1/lib/nwn/gff/writer.rb:168:in `encode': U+06CD to WINDOWS-1252 in conversion from UTF-8 to WINDOWS-1252 (Encoding::UndefinedConversionError)```
jakkn commented 5 years ago

It would help to see the command that produced this output, though I understand it's related to encoding of input files. From what I can tell nwn-lib blows up when fed windows-1252 encoded files, so before looking deeper I would like to question the reasoning behind using this encoding for GFF resources in the first place.

Given that only .nss files need be encoded in windows-1252, may I suggest you add this config to your project and leave everything else as utf-8:

$ cat .vscode/settings.json 
{
    "[nwscript]": {
        "files.encoding": "windows1252"
    }
}

That is assuming you use vscode. If not then I'm sure other editors have similar configs.

urothis commented 5 years ago

You guessed correctly. I have integrated that into my dotfiles now. Closing.