2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.23 2003/05/13 07:39:22 joko |
6 |
|
## new option 'define' for "sub expand": set value to empty string if desired |
7 |
|
## |
8 |
## Revision 1.22 2003/05/10 17:09:18 jonen |
## Revision 1.22 2003/05/10 17:09:18 jonen |
9 |
## + added keep of empty arrays/hashes if 'expand' for php |
## + added keep of empty arrays/hashes if 'expand' for php |
10 |
## |
## |
172 |
|
|
173 |
# convert values in hash to utf8 (and back) to be ready for (e.g.) encapsulation in XML |
# convert values in hash to utf8 (and back) to be ready for (e.g.) encapsulation in XML |
174 |
# but still using the known latin locale stuff |
# but still using the known latin locale stuff |
175 |
|
# TODO: Review: Could this be revamped using Clone.pm? |
176 |
sub expand { |
sub expand { |
177 |
|
|
178 |
my $obj = shift; |
my $obj = shift; |
211 |
$item = latin_to_utf8_scalar($item) if ($item && $options->{utf8}); |
$item = latin_to_utf8_scalar($item) if ($item && $options->{utf8}); |
212 |
$item = utf8_to_latin_scalar($item) if ($item && $options->{to_latin}); |
$item = utf8_to_latin_scalar($item) if ($item && $options->{to_latin}); |
213 |
} |
} |
214 |
|
|
215 |
|
$item = '' if $options->{define} and not defined $item; |
216 |
#push(@{$result}, $item) if $item; # use item only if not undef (TODO: make configurable via $options) |
#push(@{$result}, $item) if $item; # use item only if not undef (TODO: make configurable via $options) |
217 |
push(@{$result}, $item); # use item in any case |
push(@{$result}, $item); # use item in any case |
218 |
|
|
256 |
$item = latin_to_utf8_scalar($item) if ($item && $options->{utf8}); |
$item = latin_to_utf8_scalar($item) if ($item && $options->{utf8}); |
257 |
$item = utf8_to_latin_scalar($item) if ($item && $options->{to_latin}); |
$item = utf8_to_latin_scalar($item) if ($item && $options->{to_latin}); |
258 |
} |
} |
259 |
|
|
260 |
|
$item = '' if $options->{define} and not defined $item; |
261 |
#$result->{$_[0]} = $item if $item; # use item only if not undef (TODO: make configurable via $options) |
#$result->{$_[0]} = $item if $item; # use item only if not undef (TODO: make configurable via $options) |
262 |
$result->{$_[0]} = $item; # use item in any case |
$result->{$_[0]} = $item; # use item in any case |
263 |
} |
} |