Menu

#1187 Wrong encoding after changes in opend file since TS 2.8.4

None
closed
nobody
None
1
2015-02-08
2014-12-21
Anonymous
No

I have TeX-Files created by an external program. These have an partially somewhat "exotic encoding" which is recognized by TS as ISO-8859-1. Whith a personal macro I can change the wrong charcters to UTF-8. This macro also inserts "% !Tex encoding = utf8" at the beginning of the document and a "\usepackage[utf8]{inputenc}". In the configuration of TS I have choosen UTF-8 for the standard encoding.
Until TS 2.8.2 I then could start PDFLATEX whithout problems as the the encoding was correctly detected as changed to UTF-8.
Since TS 2.8.4 (?) the editor still detects the previous ISO-8859-1 after my macro-run and gives various errors. This is only avoidable by manually changing the encoding in the corresponding dialog.

Is this a new wanted feature or is there a new combination of the auto-detection-switches to avoid this behaviour?

Tested on Windows XP with the portable edition.

Discussion

  • Tim Hoffmann

    Tim Hoffmann - 2015-01-05

    copied from https://sourceforge.net/p/texstudio/bugs/1191/

    Thank you for your tips. The problem is still remainig. I have done some tests with a minimal working example. The mentioned effect turned on between release 2.8.4 and 2.8.6 (always windows portable tested). It did not exist in 2.8.2 too and it remains in 2.8.8 and the snapshot you gave me.

    I appended a very small TeX-File with my original encoding and in LaTeX 2.09 (TEST.TEX).
    It is recognized by all mentioned releases as ISO-8859-1 encoding.
    This is converted by the macro "testmacro" in two used characters (german umlauts) to UTF-8 encoding and in LaTeX 2e.
    After this the older releases until 2.8.4 recognize a new encoding: UTF-8. LaTeXing works and the file is saved in UTF-8 encoding and can be loaded as UTF-8 next time (TEST_284.TEX). So all is OK.
    After the macro-run the newer releases starting from 2.8.6 do not change the formerly recognized encoding and stay at ISO-8859-1 (which was at loading time close but not right, because my encoding is none of the available ones). A TeX-run ends with an error: "Package inputenc Error in line 9". Saving the file is done in the unchanged ISO-8859-1 format (TEST_286.TEX). Reloading is done in UTF-8 (presumably because of the starting line "% !Tex encoding = utf8"). This is apparantly not correct and again gives LaTeX errors.

    You can test the effect also by doing the changes by hand. It is not a problem of the macro. The older releases change the recognized encoding at the moment you insert the "% !Tex encoding = utf8", the newer ones don't. I think that this should be interpreted as a direct order to the editor an therefor be checked at every save or compile. The newer behaviour is insofar incomprehensible as the "Config -> Editor -> Automatic Encoding Detection" was in all releases the same:
    Default Font Encoding: UTF-8
    Automatic Encoding Detection / Analyze Latex: On
    Automatic Encoding Detection / Analyze Characters: On

    I suppose that the encoding detection was formerly done more often than now (only at loading time?)

    That is all I could find out. Many thanks for your invested time in this very good software and for helping the users.

     

    Last edit: Tim Hoffmann 2015-01-05
  • Tim Hoffmann

    Tim Hoffmann - 2015-01-05

    The behavior seems to have changed because of a new and improved text replacement function for scripts (hg 4726 0789d9cb4066)

    I don't know if we explicitly support changing the encoding as a side effect of a text replacement. Might be that the old implementation just did this by chance.

    Benito, can you please comment on this?

     

    Last edit: Tim Hoffmann 2015-02-08
  • Tim Hoffmann

    Tim Hoffmann - 2015-02-08

    see also [bugs:#1230]

     

    Related

    Bugs: #1230

  • Tim Hoffmann

    Tim Hoffmann - 2015-02-08
    • status: open --> closed
    • Group: -->
     

Log in to post a comment.