Re: UTF-8 error in GtkTextView while decoding base64
- From: David Nečas <yeti physics muni cz>
- To: a <vis 314 15 gmail com>
- Cc: gtk-list gnome org
- Subject: Re: UTF-8 error in GtkTextView while decoding base64
- Date: Tue, 15 Apr 2014 09:32:05 +0200
On Mon, Apr 14, 2014 at 02:22:00PM -0400, a wrote:
const Glib::ustring str = Glib::Base64::decode("YmJi3A==");
YmJi3A== represents the four bytes 0x62 0x62 0x62 0xdc. This is not
valid UTF-8. So, you get an assertion error because you must pass valid
UTF-8 to essentially all Gtk+ function. If you take untrusted strings
use g_utf8_validate() to validate them and reject those that do not
pass.
So
my question is how can I get Gtk::TextView to display the decoded base64?
This is nonsensical question. Base64 does not have anything to do with
it. Your text is the sequence of four bytes above and it is invalid.
Why it is invalid? Hard to tell. Base64 is just a change of
representation of the same invalid sequence of bytes.
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]