Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
gtk: make sure the text in textview is UTF-8 decoded. (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Jan 8, 2021
1 parent fa2f9eb commit b66ebc7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/gtk-straw-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,12 @@ sub set_text {
my ($object, $text, %args) = @_;
my $object_buffer = $object->get_buffer;

require Encode;

if (!Encode::is_utf8($text)) {
$text = Encode::decode_utf8($text);
}

if ($args{append}) {
my $iter = $object_buffer->get_end_iter;
$object_buffer->insert($iter, $text);
Expand Down

0 comments on commit b66ebc7

Please # to comment.