From 90229329fc13e65aaad7cab6176bb6f758136a6c Mon Sep 17 00:00:00 2001
From: Gerhard Gonter <ggonter@gmail.com>
Date: Wed, 23 Aug 2017 15:41:22 +0200
Subject: [PATCH] save the encoding in the note file

---
 perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm b/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm
index 4274bcd..4fce3e6 100755
--- a/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm
+++ b/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm
@@ -522,7 +522,7 @@ sub save
   my $note= shift;
   my $out_dir= shift;
   my $fnm_out= shift;
-  my $no_utf8= shift;
+  my $no_utf8= shift; # NOTE: this is experimental for the (broken) Android version of Tomboy (Tomdroid or so)
 
   # refresh lines, if they are not up-to-date
   $note->update() unless ($note->{'flg_lines'});
@@ -558,10 +558,12 @@ sub save
   }
 
   my $out_mode= '>:utf8';
+  my $xml_encoding= 'utf-8';
   if ($no_utf8)
   {
     print "save with no utf8!\n";
     $out_mode= '>:encoding(iso-8859-7)';
+    $xml_encoding= 'iso-8859-7'; # TODO: or whatever XML needs here..
   }
 
   unless (open (FO, $out_mode, $fnm_out))
@@ -573,8 +575,8 @@ sub save
   print "writing note [$fnm_out]: [$title]\n"; # TODO: if verbose
 
   print FO chr(65279); # write a BOM, Tomboy seems to like that
-  print FO <<EOX;
-<?xml version="1.0" encoding="utf-8"?>
+  print FO <<"EOX";
+<?xml version="1.0" encoding="$xml_encoding"?>
 <note version="0.3" xmlns:link="http://beatniksoftware.com/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size" xmlns="http://beatniksoftware.com/tomboy">
 EOX
   print FO '  <title>'. Util::XML_Parser_Tree::tlt_str($title) ."</title>\n";
-- 
GitLab