/[suikacvs]/markup/html/whatpm/Whatpm/Charset/UniversalCharDet.pm
Suika

Contents of /markup/html/whatpm/Whatpm/Charset/UniversalCharDet.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Feb 10 07:34:10 2008 UTC (17 years, 3 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +14 -3 lines
++ whatpm/t/ChangeLog	10 Feb 2008 07:34:02 -0000
2008-02-10  Wakaba  <wakaba@suika.fam.cx>

	* css-3.dat: New test file.

	* CSS-Parser-1.t: |css-3.dat| is added.  '-moz-pre-wrap' added.
	Typo for 'collapse' value fixed.  Support for '@namespace'
	serialization.

	* css-1.dat: New test data for selectors parsing.

	* css-font.dat: Error locations for 'u' errors are corrected.

	* css-table.dat: Test data for 'border-collapse' are added.

	* css-text.dat: Test data for '-moz-pre-wrap' are added.

	* css-visual.dat: Test data for 'background-position' are added.

++ whatpm/Whatpm/Charset/ChangeLog	10 Feb 2008 07:31:32 -0000
2008-02-10  Wakaba  <wakaba@suika.fam.cx>

	* CharDet.pm (detect): Catch an error in detection function.

++ whatpm/Whatpm/CSS/ChangeLog	10 Feb 2008 07:30:34 -0000
2008-02-10  Wakaba  <wakaba@suika.fam.cx>

	* Parser.pm: |attr(prefix|localname)| did not work.  Support
	for uppercase namespace prefixes (namespace prefixes were
	not normalized into lowercase when they were looked up.).  Report
	the property name token when an unknown property error is raised.
	The '-moz-pre-wrap' value is supported for 'white-space' property.
	('background-position'): 'center left' and 'center right'
	were not supported.

	* SelectorsParser.pm: Report the namespace prefix token when
	an undeclared prefix error is raised.  S_TOKEN in
	COMBINATOR_STATE was not handled correctly.

1 package Whatpm::Charset::UniversalCharDet;
2 use strict;
3 our $VERSION=do{my @r=(q$Revision: 1.1 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
4
5 our $DEBUG;
6
7 sub _detect ($) { undef }
8
9 eval q{
10 use Inline Python => '
11 import chardet
12
13 def _detect(s):
14 return chardet.detect (s)
15
16 ';
17 1;
18 } or do {
19 warn $@ unless $DEBUG;
20 die $@ if $DEBUG;
21 };
22
23 sub detect_byte_string ($$) {
24 my $de;
25 eval {
26 $de = _detect ($_[1]);
27 1;
28 } or do {
29 ## NOTE: As far as I can tell, Python implementation of UniversalCharDet
30 ## is broken for some input (at least for a broken ISO-2022-JP text it
31 ## croaks).
32 warn $@ unless $DEBUG;
33 die $@ if $DEBUG;
34 };
35 if (defined $de and defined $de->{encoding}) {
36 return lc $de->{encoding};
37 } else {
38 return undef;
39 }
40 } # detect_byte_string
41
42 =head1 LICENSE
43
44 Copyright 2007 Wakaba <w@suika.fam.cx>
45
46 This library is free software; you can redistribute it
47 and/or modify it under the same terms as Perl itself.
48
49 =cut
50
51 1;
52 ## $Date: 2007/11/19 12:18:27 $
53 # LocalWords: noClear JIS

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24