mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib/MHonArc Char.pm,1.1,1.2 Encode.pm,1.1,1.2 UTF8.pm,...

2002-12-20 01:01:38
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib/MHonArc
In directory subversions:/tmp/cvs-serv3849/MHonArc

Modified Files:
	Char.pm Encode.pm UTF8.pm 
Log Message:
* Added implementation of TEXTENCODE resource.


Index: Char.pm
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/MHonArc/Char.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Char.pm	18 Dec 2002 05:38:43 -0000	1.1
--- Char.pm	20 Dec 2002 08:01:11 -0000	1.2
***************
*** 27,32 ****
  package MHonArc::Char;
  
- use strict;
- 
  ###############################################################################
  ##	Routines
--- 27,30 ----

Index: Encode.pm
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/MHonArc/Encode.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Encode.pm	18 Dec 2002 05:38:43 -0000	1.1
--- Encode.pm	20 Dec 2002 08:01:11 -0000	1.2
***************
*** 50,62 ****
      my $to_enc   = lc shift;
  
      # Strip utf8 string flag if set
      if (Encode::is_utf8($$text_r)) {
  	$$text_r = Encode::encode('utf8', $$text_r);
      }
!     my $len = Encode::from_to($$text_r, $from_enc, $to_enc);
!     warn qq/Warning: MHonArc::Encode: Unable to convert /,
! 		  qq/"$from_enc" to "$to_enc"\n/
! 	unless defined($len);
!     $to_enc;
  }
  
--- 50,72 ----
      my $to_enc   = lc shift;
  
+     return ''  if $$text_r eq '';
+ 
      # Strip utf8 string flag if set
      if (Encode::is_utf8($$text_r)) {
  	$$text_r = Encode::encode('utf8', $$text_r);
      }
!     my $is_error = 0;
!     eval {
! 	if (!defined(Encode::from_to($$text_r, $from_enc, $to_enc))) {
! 	    warn qq/Warning: MHonArc::Encode: Unable to convert /,
! 			  qq/"$from_enc" to "$to_enc"\n/;
! 	    $is_error = 1;
! 	}
!     };
!     if ($@) {
! 	warn qq/Warning: $(_at_)\n/;
! 	$is_error = 1;
!     }
!     $is_error ? undef : $to_enc;
  }
  
***************
*** 93,103 ****
  
    <TextEncode>
!   charset
    </TextEncode>
  
-   <TextEncoderFunc>
-   MHonArc::Encode::from_to; MHonArc/Encode.pm
-   </TextEncoderFunc>
- 
  =head1 DESCRIPTION
  
--- 103,109 ----
  
    <TextEncode>
!   charset; MHonArc::Encode::from_to; MHonArc/Encode.pm
    </TextEncode>
  
  =head1 DESCRIPTION
  
***************
*** 105,109 ****
  encoding to text in another encoding.
  
! If you converting all data into utf-8, it may be more convenient
  to use the L<MHonArc::UTF8|MHonArc::UTF8> module instead.
  
--- 111,115 ----
  encoding to text in another encoding.
  
! If you converting all data into utf-8, it is recommended
  to use the L<MHonArc::UTF8|MHonArc::UTF8> module instead.
  
***************
*** 114,126 ****
  =item C<MHonArc::Encode::from_to($data_ref, $from_charset, $to_charset)>
  
! This function is designed to be registered to the TEXTENCODERFUNC
  resource:
  
    <TextEncode>
!   charset
    </TextEncode>
-   <TextEncoderFunc>
-   MHonArc::Encode::from_to; MHonArc/Encode.pm
-   </TextEncoderFunc>
  
  Converts C<$data_ref> encoded in C<$from_charset> into C<$to_charset>).
--- 120,129 ----
  =item C<MHonArc::Encode::from_to($data_ref, $from_charset, $to_charset)>
  
! This function is designed to be registered to the TEXTENCODE
  resource:
  
    <TextEncode>
!   charset; MHonArc::Encode::from_to; MHonArc/Encode.pm
    </TextEncode>
  
  Converts C<$data_ref> encoded in C<$from_charset> into C<$to_charset>).
***************
*** 153,157 ****
  L<MHonArc::UTF8|MHonArc::UTF8>
  
! The TEXTENCODE and TEXTENCODERFUNC resources in the MHonArc documentation.
  
  =head1 VERSION
--- 156,160 ----
  L<MHonArc::UTF8|MHonArc::UTF8>
  
! The TEXTENCODE and CHARSETCONVERTERS resources in the MHonArc documentation.
  
  =head1 VERSION

Index: UTF8.pm
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/MHonArc/UTF8.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** UTF8.pm	18 Dec 2002 05:38:43 -0000	1.4
--- UTF8.pm	20 Dec 2002 08:01:11 -0000	1.5
***************
*** 101,116 ****
  =item C<MHonArc::UTF8::to_utf8($data, $from_charset, $to_charset)>
  
! This function is designed to be registered to the TEXTENCODERFUNC
  resource:
  
    <TextEncode>
!   utf-8
    </TextEncode>
-   <TextEncoderFunc>
-   MHonArc::UTF8::to_utf8; MHonArc/UTF8.pm
-   </TextEncoderFunc>
- 
- Converts C<$data> encoded in C<$from_charset> into UTF-8.
- C<$to_charset> is ignored since it assumed to be C<utf-8>.
  
  =item C<MHonArc::UTF8::str2sgml($data, $charset)>
--- 101,113 ----
  =item C<MHonArc::UTF8::to_utf8($data, $from_charset, $to_charset)>
  
! Converts C<$data> encoded in C<$from_charset> into UTF-8.
! C<$to_charset> is ignored since it assumed to be C<utf-8>.
! 
! This function is designed to be registered to the TEXTENCODE
  resource:
  
    <TextEncode>
!   utf-8; MHonArc::UTF8::to_utf8; MHonArc/UTF8.pm
    </TextEncode>
  
  =item C<MHonArc::UTF8::str2sgml($data, $charset)>
***************
*** 178,182 ****
  =head1 SEE ALSO
  
! The CHARSETCONVERTERS, TEXTCLIPFUNC, TEXTENCODE, and TEXTENCODERFUNC
  resources in the MHonArc documentation.
  
--- 175,179 ----
  =head1 SEE ALSO
  
! The CHARSETCONVERTERS, TEXTCLIPFUNC, and TEXTENCODE
  resources in the MHonArc documentation.
  

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV