[vlc-commits] pls: autodetect Latin-1 if input is not UTF-8
Rémi Denis-Courmont
git at videolan.org
Sat Jul 7 10:37:40 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jul 7 11:31:23 2018 +0300| [c36a738c62bf8fd48468e1c07a62e2f37c1fb9f2] | committer: Rémi Denis-Courmont
pls: autodetect Latin-1 if input is not UTF-8
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c36a738c62bf8fd48468e1c07a62e2f37c1fb9f2
---
modules/demux/playlist/pls.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c
index 8ea3202b70..b9ed4f88ac 100644
--- a/modules/demux/playlist/pls.c
+++ b/modules/demux/playlist/pls.c
@@ -31,6 +31,7 @@
#include <vlc_common.h>
#include <vlc_access.h>
+#include <vlc_charset.h>
#include "playlist.h"
@@ -76,11 +77,26 @@ static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
char *psz_value;
int i_item = -1;
input_item_t *p_input;
+ bool ascii = true;
+ bool unicode = true;
input_item_t *p_current_input = GetCurrentItem(p_demux);
while( ( psz_line = vlc_stream_ReadLine( p_demux->s ) ) )
{
+ if (ascii && !IsASCII(psz_line))
+ {
+ unicode = IsUTF8(psz_line);
+ ascii = false;
+ }
+
+ if (!unicode)
+ {
+ char *latin = FromLatin1(psz_line);
+ free(psz_line);
+ psz_line = latin;
+ }
+
if( !strncasecmp( psz_line, "[playlist]", sizeof("[playlist]")-1 ) ||
!strncasecmp( psz_line, "[Reference]", sizeof("[Reference]")-1 ) )
{
More information about the vlc-commits
mailing list