utf8.pm 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # -*-perl-*-
  2. #+##############################################################################
  3. #
  4. # utf8.pm: convert accented letters to utf8
  5. #
  6. # This style doesn't work when outputting info.
  7. #
  8. # Copyright (C) 2004, 2006 Free Software Foundation, Inc.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 3 of the License,
  13. # or (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. #
  23. # Originally written by Patrice Dumas.
  24. #
  25. #-##############################################################################
  26. set_default('USE_ISO', 0);
  27. set_from_init_file('ENCODING_NAME', 'utf-8');
  28. use Encode;
  29. use Unicode::Normalize;
  30. foreach my $key (keys(%unicode_accents), 'dotless')
  31. {
  32. $style_map{$key}->{'function'} = \&t2h_utf8_accent;
  33. $style_map_texi{$key}->{'function'} = \&t2h_utf8_accent;
  34. $style_map_pre{$key}->{'function'} = \&t2h_utf8_accent;
  35. }
  36. foreach my $key (%things_map)
  37. {
  38. if (exists($unicode_map{$key}) and ($unicode_map{$key} ne ''))
  39. {
  40. $things_map{$key} = chr(hex($unicode_map{$key}));
  41. $texi_map{$key} = chr(hex($unicode_map{$key}));
  42. $sorting_things_map{$key} = chr(hex($unicode_map{$key}));
  43. $pre_map{$key} = chr(hex($unicode_map{$key}));
  44. }
  45. }
  46. $normal_text = \&t2h_utf8_normal_text;
  47. 1;