forked from xslate/p5-Text-Xslate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid generating malformed UTF-8 and replacement characters by interp…
…olating the variable as-is if it is not a valid UTF-8 sequence (nc), Github issue xslate#88
- Loading branch information
Michael Kröll
committed
Feb 15, 2016
1 parent
b4e4b39
commit 51a86b2
Showing
4 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!perl | ||
# https://github.com/xslate/p5-Text-Xslate/issues/88 | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
|
||
use utf8; | ||
use Text::Xslate 'mark_raw'; | ||
my $xslate = Text::Xslate->new(); | ||
|
||
is $xslate->render_string('<: $string :>', {string => "Ä"}) => 'Ä'; | ||
is $xslate->render_string('<: $string :>', {string => "\x{c4}"}) => 'Ä'; | ||
|
||
is $xslate->render_string('あ<: $string :>', {string => "Ä"}) => 'あÄ'; | ||
is $xslate->render_string('あ<: $string :>', {string => "\x{c4}"}) => 'あÄ'; | ||
|
||
is $xslate->render_string('<: $string :>', {string => mark_raw("Ä")}) => 'Ä'; | ||
is $xslate->render_string('<: $string :>', {string => mark_raw("\x{c4}")}) => 'Ä'; | ||
|
||
is $xslate->render_string('あ<: $string :>', {string => mark_raw("Ä")}) => 'あÄ'; | ||
is $xslate->render_string('あ<: $string :>', {string => mark_raw("\x{c4}")}) => 'あÄ'; | ||
|
||
done_testing(); |