[gnome-games/wip/aplazas/unicode: 4/4] cue-sheet: Read files as converted to UTF-8



commit 8f93e6b88aa6359adf10b5b8aa90d33d1390ec36
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri May 4 22:53:42 2018 +0200

    cue-sheet: Read files as converted to UTF-8
    
    This allows to parse CUE sheets encoded in UTF-8, UTF-16BE, UTF-16LE,
    UTF-32BE or UTF-32LE.
    
    https://gitlab.gnome.org/GNOME/gnome-games/issues/19

 src/utils/cue-sheet/cue-sheet.vala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/utils/cue-sheet/cue-sheet.vala b/src/utils/cue-sheet/cue-sheet.vala
index c1d5b3b..b334b03 100644
--- a/src/utils/cue-sheet/cue-sheet.vala
+++ b/src/utils/cue-sheet/cue-sheet.vala
@@ -28,13 +28,13 @@ public class Games.CueSheet : Object {
        }
 
        private string[] tokenize () throws Error {
-               var stream = file.read ();
+               var stream = Unicode.read (file, Unicode.Encoding.UTF_8);
                var data_stream = new DataInputStream (stream);
 
                string[] tokens = {};
 
                string? line;
-               while ((line = data_stream.read_line ()) != null)
+               while ((line = data_stream.read_line_utf8 ()) != null)
                        foreach (var token in tokenize_line (line))
                                tokens += token;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]