1# Copyright (C) 1998-09  Stephane Galland <galland@arakhne.org>
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; see the file COPYING.  If not, write to
15# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16# Boston, MA 02111-1307, USA.
17
18=pod
19
20=head1 NAME
21
22Bib2HTML::General::Encode - String encoding functions
23
24=head1 DESCRIPTION
25
26Bib2HTML::General::Encode is a Perl module, which proposes
27a set of functions for string encoding.
28
29=head1 METHOD DESCRIPTIONS
30
31This section contains only the methods in Encode.pm itself.
32
33=over
34
35=cut
36
37package Bib2HTML::General::Encode;
38
39@ISA = ('Exporter');
40@EXPORT = qw( &set_default_encoding &get_default_encoding &get_encoded_str );
41@EXPORT_OK = qw();
42
43use strict;
44use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
45
46use Encode;
47
48#------------------------------------------------------
49#
50# Global vars
51#
52#------------------------------------------------------
53
54# Version number of the encode functions
55my $VERSION = "1.0" ;
56
57# Default encoding
58my $DEFAULT_ENCODING = "utf-8";
59
60#------------------------------------------------------
61#
62# Functions
63#
64#------------------------------------------------------
65
66=pod
67
68=item * set_default_encoding($)
69
70Set the default encoding
71Takes 1 arg:
72
73=over
74
75=item * name (string)
76
77is a I<string> which correspond to the name of the encoding.
78
79=back
80
81=cut
82sub set_default_encoding($) {
83  $DEFAULT_ENCODING = $_[0];
84}
85
86=pod
87
88=item * get_default_encoding()
89
90Replies the default encoding.
91
92=cut
93sub get_default_encoding() {
94  return $DEFAULT_ENCODING;
95}
96
97=pod
98
99=item * get_encode_str($)
100
101Replies the specified string in the current string encoding.
102Takes 1 arg:
103
104=over
105
106=item * text (string)
107
108is a I<string> which correspond to the text to translate.
109
110=back
111
112=cut
113sub get_encoded_str($) {
114  return encode($DEFAULT_ENCODING, $_[0]);
115}
116
1171;
118__END__
119
120=back
121
122=head1 COPYRIGHT
123
124(c) Copyright 1998-09 St�phane Galland <galland@arakhne.org>, under GPL.
125
126=head1 AUTHORS
127
128=over
129
130=item *
131
132Conceived and initially developed by St�phane Galland E<lt>galland@arakhne.orgE<gt>.
133
134=back
135
136=head1 SEE ALSO
137
138bib2html.pl
139