Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-U
perl-Unicode-Map8
perl-Unicode-Map8.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Unicode-Map8.spec of Package perl-Unicode-Map8
# # spec file for package perl-Unicode-Map8 # # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: perl-Unicode-Map8 Version: 0.13 Release: 0 %define cpan_name Unicode-Map8 Summary: Mapping table between 8-bit chars and Unicode License: GPL-1.0+ or Artistic-1.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Unicode-Map8/ Source0: https://cpan.metacpan.org/authors/id/G/GA/GAAS/%{cpan_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Unicode::String) >= 2 Requires: perl(Unicode::String) >= 2 %{perl_requires} %description The _Unicode::Map8_ class implement efficient mapping tables between 8-bit character sets and 16 bit character sets like Unicode. The tables are efficient both in terms of space allocated and translation speed. The 16-bit strings is assumed to use network byte order. The following methods are available: * $m = Unicode::Map8->new( [$charset] ) The object constructor creates new instances of the Unicode::Map8 class. I takes an optional argument that specify then name of a 8-bit character set to initialize mappings from. The argument can also be a the name of a mapping file. If the charset/file can not be located, then the constructor returns _undef_. If you omit the argument, then an empty mapping table is constructed. You must then add mapping pairs to it using the addpair() method described below. * $m->addpair( $u8, $u16 ); Adds a new mapping pair to the mapping object. It takes two arguments. The first is the code value in the 8-bit character set and the second is the corresponding code value in the 16-bit character set. The same codes can be used multiple times (but using the same pair has no effect). The first definition for a code is the one that is used. Consider the following example: $m->addpair(0x20, 0x0020); $m->addpair(0x20, 0x00A0); $m->addpair(0xA0, 0x00A0); It means that the character 0x20 and 0xA0 in the 8-bit charset maps to themselves in the 16-bit set, but in the 16-bit character set 0x0A0 maps to 0x20. * $m->default_to8( $u8 ) Set the code of the default character to use when mapping from 16-bit to 8-bit strings. If there is no mapping pair defined for a character then this default is substituted by to8() and recode8(). * $m->default_to16( $u16 ) Set the code of the default character to use when mapping from 8-bit to 16-bit strings. If there is no mapping pair defined for a character then this default is used by to16(), tou() and recode8(). * $m->nostrict; All undefined mappings are replaced with the identity mapping. Undefined character are normally just removed (or replaced with the default if defined) when converting between character sets. * $m->to8( $ustr ); Converts a 16-bit character string to the corresponding string in the 8-bit character set. * $m->to16( $str ); Converts a 8-bit character string to the corresponding string in the 16-bit character set. * $m->tou( $str ); Same an to16() but return a Unicode::String object instead of a plain UCS2 string. * $m->recode8($m2, $str); Map the string $str from one 8-bit character set ($m) to another one ($m2). Since we assume we know the mappings towards the common 16-bit encoding we can use this to convert between any of the 8-bit character sets. * $m->to_char16( $u8 ) Maps a single 8-bit character code to an 16-bit code. If the 8-bit character is unmapped then the constant NOCHAR is returned. The default is not used and the callback method is not invoked. * $m->to_char8( $u16 ) Maps a single 16-bit character code to an 8-bit code. If the 16-bit character is unmapped then the constant NOCHAR is returned. The default is not used and the callback method is not invoked. The following callback methods are available. You can override these methods by creating a subclass of Unicode::Map8. * $m->unmapped_to8 When mapping to 8-bit character string and there is no mapping defined (and no default either), then this method is called as the last resort. It is called with a single integer argument which is the code of the unmapped 16-bit character. It is expected to return a string that will be incorporated in the 8-bit string. The default version of this method always returns an empty string. Example: package MyMapper; @ISA=qw(Unicode::Map8); sub unmapped_to8 { my($self, $code) = @_; require Unicode::CharName; "<" . Unicode::CharName::uname($code) . ">"; } * $m->unmapped_to16 Likewise when mapping to 16-bit character string and no mapping is defined then this method is called. It should return a 16-bit string with the bytes in network byte order. The default version of this method always returns an empty string. %prep %setup -q -n %{cpan_name}-%{version} find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644 %build %{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" %{__make} %{?_smp_mflags} %check %{__make} test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) %doc Changes diff_iso make_rfc1345_maps make_unicd_maps map8_bin2txt map8_txt2bin README rfc1345.txt umap %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor