On 06.02.2010 14:50, Jan Böcker wrote:
> AFAIK, your current approach is correct.

I was wrong. The attached patch fixes a bug in the encode_uri function.
That fixes the non-ASCII characters problem in xournal for me.

The gchar type is just typedef'd to char, which means it is signed. To
get the byte value, it must be cast to unsigned int first.

- Jan
diff --git a/src/xo-misc.c b/src/xo-misc.c
index 6f0528c..c2582c7 100644
--- a/src/xo-misc.c
+++ b/src/xo-misc.c
@@ -2441,8 +2441,8 @@ void encode_uri(gchar *encoded_uri, gint bufsize, const 
gchar *uri)
       if (k + 4 >= bufsize)
         break;
       encoded_uri[k++] = '%';
-      encoded_uri[k++] = hexa[uri[i] / 16];
-      encoded_uri[k++] = hexa[uri[i] % 16];
+      encoded_uri[k++] = hexa[(unsigned char)uri[i] / 16];
+      encoded_uri[k++] = hexa[(unsigned char)uri[i] % 16];
     }
   }
   encoded_uri[k] = 0;
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to