<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent changes to 1923: buffer-local-property encoding not taken into account in the Templates plugin</title><link href="https://sourceforge.net/p/jedit/plugin-bugs/1923/" rel="alternate"/><link href="https://sourceforge.net/p/jedit/plugin-bugs/1923/feed.atom" rel="self"/><id>https://sourceforge.net/p/jedit/plugin-bugs/1923/</id><updated>2022-11-15T21:19:44.684000Z</updated><subtitle>Recent changes to 1923: buffer-local-property encoding not taken into account in the Templates plugin</subtitle><entry><title>buffer-local-property encoding not taken into account in the Templates plugin</title><link href="https://sourceforge.net/p/jedit/plugin-bugs/1923/" rel="alternate"/><published>2022-11-15T21:19:44.684000Z</published><updated>2022-11-15T21:19:44.684000Z</updated><author><name>Harry KARADIMAS</name><uri>https://sourceforge.net/u/hkara01/</uri></author><id>https://sourceforge.netf46703aaee59b69c9660d5618131d99acb2cf16e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If you put a buffer-local-property like this :&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;:encoding=UTF-8:
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;into a vm template it will not be taken into account when the file will be generated.&lt;br/&gt;
The buffer will still be in the native encoding (cp1252 in my Windows 11 for ex.).&lt;br/&gt;
This is confusing and I often got caught in this issue.&lt;/p&gt;
&lt;p&gt;I found a workaround, I add these 4 lines somewhere in the template :&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;#&lt;span class="nv"&gt;beanshell&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;false&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="nv"&gt;buffer&lt;/span&gt;.&lt;span class="nv"&gt;setStringProperty&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;buffer&lt;/span&gt;.&lt;span class="nv"&gt;ENCODING&lt;/span&gt;,&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"UTF-8"&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="nv"&gt;view&lt;/span&gt;.&lt;span class="nv"&gt;getStatus&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt;.&lt;span class="nv"&gt;updateBufferStatus&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
#&lt;span class="k"&gt;end&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Hope it helps.&lt;/p&gt;
&lt;p&gt;(jEdit 5.6.0, Templates plugin 5.0.3)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>