Changeset 17328
- Timestamp:
- 08/10/08 18:32:37 (5 years ago)
- Location:
- lang/perl/FormValidator-LazyWay/trunk
- Files:
-
- 4 added
- 1 modified
-
lib/FormValidator/LazyWay/Rule/Japanese.pm (modified) (3 diffs)
-
t/rule-japanese-hiragana-bytes.t (added)
-
t/rule-japanese-hiragana.t (added)
-
t/rule-japanese-katakana-bytes.t (added)
-
t/rule-japanese-katakana.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/FormValidator-LazyWay/trunk/lib/FormValidator/LazyWay/Rule/Japanese.pm
r13091 r17328 3 3 use strict; 4 4 use warnings; 5 use Encode (); 5 6 6 7 sub hiragana { … … 8 9 my $args = shift; 9 10 10 utf8::decode($text) 11 unless $args->{flagged}; 11 $text = Encode::decode('utf8', $text) 12 if $args->{bytes}; 13 14 if ( ref $args->{allow} eq 'ARRAY' ) { 15 foreach my $allow ( @{$args->{allow}} ) { 16 $allow = Encode::decode('utf8', $allow) 17 if $args->{bytes}; 18 $text =~ s{$allow}{}xmsg; 19 } 20 } 21 12 22 return ( $text =~ m{^\p{InHiragana}+$} ) ? 1 : 0; 13 23 } … … 17 27 my $args = shift; 18 28 19 utf8::decode($text) 20 unless $args->{flagged}; 29 $text = Encode::decode('utf8', $text) 30 if $args->{bytes}; 31 32 if ( ref $args->{allow} eq 'ARRAY' ) { 33 foreach my $allow ( @{$args->{allow}} ) { 34 $allow = Encode::decode('utf8', $allow) 35 if $args->{bytes}; 36 $text =~ s{$allow}{}xmsg; 37 } 38 } 39 21 40 return ( $text =~ m{^\p{InKatakana}+$} ) ? 1 : 0; 22 41 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)