Index: trunk/extensions/AbuseFilter/parser_native/affunctions.cpp |
— | — | @@ -5,6 +5,7 @@ |
6 | 6 | #include <ios> |
7 | 7 | #include <iostream> |
8 | 8 | #include <ctype.h> |
| 9 | +#include <unicode/unistr.h> |
9 | 10 | |
10 | 11 | #define EQUIVSET_LOC "equivset.txt" |
11 | 12 | |
— | — | @@ -86,8 +87,9 @@ |
87 | 88 | if (!args.size()) { |
88 | 89 | throw new AFPException( "Not enough arguments to lcase" ); |
89 | 90 | } |
90 | | - |
91 | | - return AFPData( (long int)args[0].toString().size() ); |
| 91 | + |
| 92 | + UnicodeString ustr = UnicodeString( (UChar*)args[0].toString().c_str() ); |
| 93 | + return AFPData( (long int)ustr.length() ); |
92 | 94 | } |
93 | 95 | |
94 | 96 | AFPData af_lcase( vector<AFPData> args ) { |
— | — | @@ -95,11 +97,13 @@ |
96 | 98 | throw new AFPException( "Not enough arguments to lcase" ); |
97 | 99 | } |
98 | 100 | |
99 | | - string s = args[0].toString(); |
| 101 | + int initlen = args[0].toString().length(); |
| 102 | + UnicodeString us = UnicodeString( args[0].toString().c_str() ); |
| 103 | + us = us.toLower(); |
| 104 | + char* result = (char*)malloc(initlen); |
| 105 | + us.extract(0, us.length(), result); |
100 | 106 | |
101 | | - transform( s.begin(), s.end(), s.begin(), (int(*)(int)) tolower ); |
102 | | - |
103 | | - return AFPData(s); |
| 107 | + return AFPData(string(result)); |
104 | 108 | } |
105 | 109 | |
106 | 110 | string confusable_character_normalise( string orig ) { |
Index: trunk/extensions/AbuseFilter/parser_native/makefile |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | all: check |
5 | 5 | |
6 | 6 | check: afeval.o affunctions.o afparser.o aftypes.o afutils.o main.o |
7 | | - g++ -g -o check -lboost_regex afeval.o affunctions.o afparser.o aftypes.o afutils.o main.o |
| 7 | + g++ -g -o check -lboost_regex -licudata afeval.o affunctions.o afparser.o aftypes.o afutils.o main.o |
8 | 8 | |
9 | 9 | .cpp.o: |
10 | 10 | g++ -g -c $< |