Debian Codegraph @

Tk/DummyEncode.pm

raw
1 package Tk::DummyEncode;
2
3 use vars qw($VERSION);
4 $VERSION = '4.007'; # $Id: //depot/Tkutf8/Tk/DummyEncode.pm#7 $
5
6 sub getEncoding
7 {
8 my ($class,$name) = @_;
9 return undef unless ($name =~ /(iso8859-1|X11ControlChars)/);
10 my $pkg = $name;
11 $pkg =~ s/\W+/_/g;
12 return bless {Name => $name},$class.'::'.$pkg;
13 }
14
15 package Tk::DummyEncode::iso8859_1;
16 sub encode
17 {
18 my ($obj,$uni,$chk) = @_;
19 $_[1] = '' if $chk;
20 return $uni;
21 }
22
23 sub decode
24 {
25 my ($obj,$byt,$chk) = @_;
26 $_[1]
27 = '' if $chk;
28 return $byt;
29 }
30
31 package Tk::DummyEncode::X11ControlChars;
32 sub encode
33 {
34 my ($obj,$uni,$chk) = @_;
35 my $str = '';
36 foreach my $ch (split(//,$uni))
37 {
38 $str .= sprintf("\\x{%x}",ord($ch));
39 }
40 $_[1] = '' if $chk;
41 return $str;
42 }
43
44 1;
45
46 __END__