Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
search.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
25 Oct 2008 at 14:30 UTC
Updated:
23 May 2010 at 21:10 UTC
Jump to comment: Most recent file
I'm running a multilingual site (include CJK contents) with Drupal 6.6.
I've found that a string of Korean characters (Hangul) aren't splitted due to PREG_CLASS_CJK in search.module.
I think PREG_CLASS_CJK should be following, and it works well on my site.
\x{1100}-\x{11FF}\x{2E80}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{31FF}\x{3200}-\x{4DBF}\x{4E00}-\x{9FFF}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\x{FF66}-\x{FF9F}\x{FFA1}-\x{FFDF}\x{20000}-\x{2A6DF}\x{2F800}-\x{2FA1F}
Ref.
http://www.unicode.org/charts/index.html
Best regards,
--
coursek
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 326016-fixtypo.patch | 8.73 KB | jhodgdon |
| #9 | 326016.patch | 8.73 KB | jhodgdon |
Comments
Comment #1
jhodgdonWe need to check and see if this is an issue in Drupal 7, fix there if so, and then (either way) check on/fix Drupal 6.
Comment #2
jhodgdonAnother issue lists some other character ranges that need to be added to PREG_CLASS_CJK -- I have marked that issue as a duplicate, but please check that issue for additional character ranges:
#115843: add CJK ranges above U+FFFF to PREG_CLASS_CJK
Comment #3
jhodgdonHere's what we have now for CJK in Drupal 7:
\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{4e00}-\x{9fbb}\x{f900}-\x{fad9}
http://www.unicode.org/charts/index.html has a bunch of information about CJK and Hangul character ranges... they go beyond what is suggested above.
And from that other issue, I can confirm from the unicode.org site:
http://unicode.org/reports/tr11/tr11-11.html - "U+20000 to U+2FFFD and U+30000 to U+3FFFD are intended for CJK ideographs"
So it does look like we want to expand this. But I'm not sure about the exact proposal above. I think that proposal is not complete enough.
Comment #4
jhodgdonI checked out the charts from the above sites. Things that I think should be part of the CJK regular expression:
http://unicode.org/reports/tr11/tr11-11.html : 20000 - 2FFFD, 30000 3FFFD
Additionally from http://www.unicode.org/charts/index.html :
- CJK Unified : 4E00 - 9FCF
- CJK Extension A : 3400 - 4DBF
- CKJ Compat : F900 - FAFF
- Hangul Jamo : 1100 - 11FF
- H. Extension A : A960 - A97F
- H. Extension B : D7B0 - D7FF
- H. Combatibilty : 3130 - 318F
- H. Half-width : FF00 - FFEF
- H. Syllables: AC00 - D7AF
- Hiragana: 3040 - 309F
- Katakana: 30A0 - 30FF
- K. extension : 31F0 - 31FF
- K. half-width : FF00 - FFEF
Comment #5
jhodgdonOK, I wanted to save that before my browser died or something. Putting this all together, it looks like we need, in order:
1100 - 11FF
3040 - 309F
30A0 - 30FF
3130 - 318F
31F0 - 31FF
3400 - 4DBF
4E00 - 9FCF
A960 - A97F
AC00 - D7AF
D7B0 - D7FF
F900 - FAFF
FF00 - FFEF
20000 - 2FFFD
30000 - 3FFFD
As compared to what we have now:
\x{3041}-\x{30ff}\x{31f0}-\x{31ff}\x{3400}-\x{4db5}\x{4e00}-\x{9fbb}\x{f900}-\x{fad9}
At least my list is a super-set... :)
Comment #6
jhodgdonI found some more on http://www.unicode.org/charts/index.html
Bomofo : 3100 - 312F
Bomofo ext : 31A0 - 31BF
Kanbun : 3190 - 319F
Lisu : A4D0 - A4FF
Yi : A000 - A48F
Yi radicals : A490 - A4CF
Kangxi radicals : 2F00 - 2FDF
CJK radicals : 2E80 - 2EFF
CJK strokes : 31C0 - 31EF
Ideographic descriptions : 2FF0 - 2FFF
Making the list:
1100 - 11FF
2E80 - 2EFF
2F00 - 2FDF
2FF0 - 2FFF
3040 - 309F
30A0 - 30FF
3100 - 312F
3130 - 318F
3190 - 319F
31A0 - 31BF
31C0 - 31EF
31F0 - 31FF
3400 - 4DBF
4E00 - 9FCF
A000 - A48F
A490 - A4CF
A4D0 - A4FF
A960 - A97F
AC00 - D7AF
D7B0 - D7FF
F900 - FAFF
FF00 - FFEF
20000 - 2FFFD
30000 - 3FFFD
I think it's time for a patch... (some of the above can be consolidated by the way)
Comment #7
jhodgdonI'm working on this, in case you couldn't tell...
Comment #8
jhodgdonWell.
Just a note that I needed to be a bit more careful when looking at these charts, because some of the characters are excluded. Sigh.
Comment #9
jhodgdonHere's a patch:
- Adds new ranges to the CJK preg class. Note that punctuation, symbols, and numbers are excluded, since they're handled elsewhere in search_simplify().
- Adds lots of documentation/comments.
- Changes a variable name within the search_expand_cjk() function from $l to $length for clarity
- Adds a test for the CJK tokenizer.
Comment #10
scor commenteds/Japanes/Japanese
Comment #11
jhodgdonDoh!
Comment #12
dries commentedAh, overlap_cjk -- that wasn't documented anywhere so I'm glad to see it somewhat documented now. Are there modules that set this variable, or do we expect people to somehow find out? Ideally, Drupal would set it automatically based on the configured languages but that is for another issue. This patch looks RTBC to me.
Comment #13
dries commentedCommitted to CVS HEAD. Thanks.
Comment #14
jhodgdonDries: regarding that variable, it is a configuration option on the search module settings page in the UI. See:
http://api.drupal.org/api/function/search_admin_settings/7
I don't think it needs further doc, since it's in the UI already.