Project

General

Profile

audacious_utf8_fix.patch

Kristoffer Brånemyr, October 02, 2012 22:06

View differences:

ui_fileopener.c 2012-10-02 21:54:37.321081683 +0200
31 31
 bool_t play)
32 32
{
33 33
    Index * list = index_new ();
34
    char *uri, *filename, *utf8;
34 35

  
35
    for (GSList * node = files; node; node = node->next)
36
        index_append (list, str_get (node->data));
36
    for (GSList * node = files; node; node = node->next) {
37
	/* gtk filechooser returns files in native charset, so in case
38
	 * the user doesn't use UTF-8 we need this back and forth conversion */
39
	filename = g_filename_from_uri (node->data, NULL, NULL);
40
	if (filename == NULL) 
41
		continue;
42
	
43
	utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
44
	g_free (filename);
45
	if (utf8 == NULL) 
46
		continue;
47

  
48
	uri = g_filename_to_uri (utf8, NULL, NULL);
49
	g_free (utf8);
50
	if (uri == NULL)
51
		continue;
52

  
53
        index_append (list, str_get (uri));
54
	g_free (uri);
55
    }
37 56

  
38 57
    if (play)
39 58
        aud_drct_pl_open_list (list);