[perl-Gnome2-VFS] Gnome2::VFS::Utils: return proper utf8 strings if appropriate
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gnome2-VFS] Gnome2::VFS::Utils: return proper utf8 strings if appropriate
- Date: Sun, 19 Sep 2010 13:11:17 +0000 (UTC)
commit dedc970f69c6daeaf232bb689f616528be9e32a2
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Sun Sep 19 15:03:03 2010 +0200
Gnome2::VFS::Utils: return proper utf8 strings if appropriate
Fix Gnome2::VFS->format_uri_for_display(), unescape_string() and
unescape_string_for_display() to return proper utf8 strings by using the
'gchar' typemap. Previously, they returned strings without the utf8 flag set.
Discovered by Mario Kemper.
t/GnomeVFSUtils.t | 13 +++++++------
xs/GnomeVFSUtils.xs | 6 +++---
2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/t/GnomeVFSUtils.t b/t/GnomeVFSUtils.t
index 7f8c7af..59ead8b 100644
--- a/t/GnomeVFSUtils.t
+++ b/t/GnomeVFSUtils.t
@@ -1,5 +1,6 @@
#!/usr/bin/perl -w
use strict;
+use utf8;
use Gnome2::VFS;
use Cwd qw(cwd);
@@ -27,8 +28,8 @@ SKIP: {
skip("escape_string, format_uri_for_display, gnome_vfs_make_uri_from_input, make_uri_canonical_strip_fragment, uris_match, get_uri_scheme and make_uri_from_shell_arg are new in 2.2.0", 13)
unless (Gnome2::VFS -> CHECK_VERSION(2, 2, 0));
- is(Gnome2::VFS -> escape_string('%$§'), '%25%24%A7');
- is(Gnome2::VFS -> format_uri_for_display("/usr/bin/perl"), "/usr/bin/perl");
+ is(Gnome2::VFS -> escape_string('%$§äöü'), '%25%24%C2%A7%C3%A4%C3%B6%C3%BC');
+ is(Gnome2::VFS -> format_uri_for_display("/usr/bin/äöü"), "/usr/bin/äöü");
is(Gnome2::VFS -> make_uri_from_input("gtk2-perl.sf.net"), "http://gtk2-perl.sf.net");
is(Gnome2::VFS -> make_uri_canonical_strip_fragment("http://gtk2-perl.sf.net#bla"), "http://gtk2-perl.sf.net");
ok(Gnome2::VFS -> uris_match("http://gtk2-perl.sf.net", "http://gtk2-perl.sf.net"));
@@ -60,10 +61,10 @@ SKIP: {
ok(defined(Gnome2::VFS -> make_uri_from_input_with_trailing_ws("file:///tmp")));
}
-foreach (Gnome2::VFS -> escape_path_string('%$§'),
- Gnome2::VFS -> escape_host_and_path_string('%$§')) {
- is($_, '%25%24%A7');
- is(Gnome2::VFS -> unescape_string($_), '%$§');
+foreach (Gnome2::VFS -> escape_path_string('%$§äöü'),
+ Gnome2::VFS -> escape_host_and_path_string('%$§äöü')) {
+ is($_, '%25%24%C2%A7%C3%A4%C3%B6%C3%BC');
+ is(Gnome2::VFS -> unescape_string($_), '%$§äöü');
}
is(Gnome2::VFS -> escape_slashes("/%/"), "%2F%25%2F");
diff --git a/xs/GnomeVFSUtils.xs b/xs/GnomeVFSUtils.xs
index 4e8d12c..b78dc21 100644
--- a/xs/GnomeVFSUtils.xs
+++ b/xs/GnomeVFSUtils.xs
@@ -104,7 +104,7 @@ gnome_vfs_escape_set (class, string, match_set)
string, match_set
## char *gnome_vfs_unescape_string (const char *escaped_string, const char *illegal_characters)
-char_own *
+gchar_own *
gnome_vfs_unescape_string (class, escaped_string, illegal_characters=NULL)
const char *escaped_string
const char *illegal_characters
@@ -133,7 +133,7 @@ gnome_vfs_expand_initial_tilde (class, path)
path
## char *gnome_vfs_unescape_string_for_display (const char *escaped)
-char_own *
+gchar_own *
gnome_vfs_unescape_string_for_display (class, escaped)
const char *escaped
C_ARGS:
@@ -228,7 +228,7 @@ gnome_vfs_read_entire_file (class, uri)
: newSVsv (&PL_sv_undef)));
## char * gnome_vfs_format_uri_for_display (const char *uri)
-char_own *
+gchar_own *
gnome_vfs_format_uri_for_display (class, uri)
const char *uri
C_ARGS:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]