Package tdi :: Package markup :: Package soup :: Module filters :: Class EncodingDetectFilter
[frames] | no frames]

Class EncodingDetectFilter

source code

             object --+    
                      |    
filters.BaseEventFilter --+
                          |
                         EncodingDetectFilter

Extract template encoding and pass it properly to the builder
Instance Methods
 
__init__(self, builder)
Initialization
source code
 
handle_pi(self, data)
Extract encoding from xml declaration
source code
 
handle_starttag(self, name, attr, closed, data)
Extract encoding from HTML meta element
source code

Inherited from filters.BaseEventFilter: __getattr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables

Inherited from filters.BaseEventFilter: builder

Properties

Inherited from object: __class__

Method Details

__init__(self, builder)
(Constructor)

source code 
Initialization
Parameters:
  • builder - The next level builder
Overrides: object.__init__

handle_pi(self, data)

source code 

Extract encoding from xml declaration

Here's a sample for the expected format:

<?xml version="1.0" encoding="ascii" ?>

The event is passed to the builder nevertheless.

handle_starttag(self, name, attr, closed, data)

source code 

Extract encoding from HTML meta element

Here are samples for the expected formats:

<meta charset="utf-8"> <!-- HTML5 -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

The event is passed to the builder nevertheless.