Last change
on this file since 100620 was 94320, checked in by vboxsync, 3 years ago |
libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128
|
File size:
944 bytes
|
Line | |
---|
1 | #!perl
|
---|
2 |
|
---|
3 | use utf8;
|
---|
4 | use strict;
|
---|
5 | use warnings;
|
---|
6 | use Test::More;
|
---|
7 | use Encode;
|
---|
8 | use File::Temp;
|
---|
9 |
|
---|
10 | # Non-CORE module(s)
|
---|
11 | unless (eval { require Test::More::UTF8; 1; } ) {
|
---|
12 | plan skip_all => '[ Test::More::UTF8 ] is required for testing';
|
---|
13 | }
|
---|
14 |
|
---|
15 | plan tests => 3;
|
---|
16 |
|
---|
17 | use_ok 'Text::Template' or exit 1;
|
---|
18 |
|
---|
19 | my $tmp_fh = File::Temp->new;
|
---|
20 |
|
---|
21 | print $tmp_fh encode('UTF-8', "\x{4f60}\x{597d} {{\$name}}");
|
---|
22 |
|
---|
23 | $tmp_fh->flush;
|
---|
24 |
|
---|
25 | # UTF-8 encoded template file
|
---|
26 | my $str = Text::Template->new(
|
---|
27 | TYPE => 'FILE',
|
---|
28 | SOURCE => $tmp_fh->filename,
|
---|
29 | ENCODING => 'UTF-8'
|
---|
30 | )->fill_in(HASH => { name => 'World' });
|
---|
31 |
|
---|
32 | is $str, "\x{4f60}\x{597d} World";
|
---|
33 |
|
---|
34 | $tmp_fh = File::Temp->new;
|
---|
35 |
|
---|
36 | print $tmp_fh encode('iso-8859-1', "Ol\x{e1} {{\$name}}");
|
---|
37 |
|
---|
38 | $tmp_fh->flush;
|
---|
39 |
|
---|
40 | # ISO-8859-1 encoded template file
|
---|
41 | $str = Text::Template->new(
|
---|
42 | TYPE => 'FILE',
|
---|
43 | SOURCE => $tmp_fh->filename,
|
---|
44 | ENCODING => 'iso-8859-1'
|
---|
45 | )->fill_in(HASH => { name => 'World' });
|
---|
46 |
|
---|
47 | is $str, "Ol\x{e1} World";
|
---|
Note:
See
TracBrowser
for help on using the repository browser.