3
module ActiveSupport #:nodoc:
5
# A list of all available normalization forms. See http://www.unicode.org/reports/tr15/tr15-29.html for more
6
# information about normalization.
7
NORMALIZATION_FORMS = [:c, :kc, :d, :kd]
9
# The Unicode version that is supported by the implementation
10
UNICODE_VERSION = '5.1.0'
12
# The default normalization used for operations that require normalization. It can be set to any of the
13
# normalizations in NORMALIZATION_FORMS.
16
# ActiveSupport::Multibyte.default_normalization_form = :c
17
mattr_accessor :default_normalization_form
18
self.default_normalization_form = :kc
20
# The proxy class returned when calling mb_chars. You can use this accessor to configure your own proxy
21
# class so you can support other encodings. See the ActiveSupport::Multibyte::Chars implementation for
22
# an example how to do this.
25
# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
26
def self.proxy_class=(klass)
30
# Returns the currect proxy class
32
@proxy_class ||= ActiveSupport::Multibyte::Chars
35
# Regular expressions that describe valid byte sequences for a character
37
# Borrowed from the Kconv library by Shinji KONO - (also as seen on the W3C site)
40
[\xc2-\xdf] [\x80-\xbf] |
41
\xe0 [\xa0-\xbf] [\x80-\xbf] |
42
[\xe1-\xef] [\x80-\xbf] [\x80-\xbf] |
43
\xf0 [\x90-\xbf] [\x80-\xbf] [\x80-\xbf] |
44
[\xf1-\xf3] [\x80-\xbf] [\x80-\xbf] [\x80-\xbf] |
45
\xf4 [\x80-\x8f] [\x80-\xbf] [\x80-\xbf])\z /xn,
46
# Quick check for valid Shift-JIS characters, disregards the odd-even pairing
48
[\x00-\x7e \xa1-\xdf] |
49
[\x81-\x9f \xe0-\xef] [\x40-\x7e \x80-\x9e \x9f-\xfc])\z /xn
54
require 'active_support/multibyte/chars'
55
require 'active_support/multibyte/exceptions'
56
require 'active_support/multibyte/unicode_database'
57
require 'active_support/multibyte/utils'