aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-06-04 21:14:10 +1000
committernyamatongwe <devnull@localhost>2011-06-04 21:14:10 +1000
commit40eb38b93c00093a4abe034f7f902ef432c88a4f (patch)
treefe7688a47a1905f4ff0499b1a0cc5a9f5db9179d /cocoa
parentb0c5b811707b9aaf5ddeb72733322d9c64f146b2 (diff)
downloadscintilla-mirror-40eb38b93c00093a4abe034f7f902ef432c88a4f.tar.gz
Included DBCS support.
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.mm25
1 files changed, 24 insertions, 1 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 80cc5a43b..a9ac95461 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1863,7 +1863,30 @@ long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long
bool Platform::IsDBCSLeadByte(int codePage, char ch)
{
- // No support for DBCS.
+ // Byte ranges found in Wikipedia articles with relevant search strings in each case
+ unsigned char uch = static_cast<unsigned char>(ch);
+ switch (codePage)
+ {
+ case 932:
+ // Shift_jis
+ return ((uch >= 0x81) && (uch <= 0x9F)) ||
+ ((uch >= 0xE0) && (uch <= 0xEF));
+ case 936:
+ // GBK
+ return (uch >= 0x81) && (uch <= 0xFE);
+ case 949:
+ // Korean Wansung KS C-5601-1987
+ return (uch >= 0x81) && (uch <= 0xFE);
+ case 950:
+ // Big5
+ return (uch >= 0x81) && (uch <= 0xFE);
+ case 1361:
+ // Korean Johab KS C-5601-1992
+ return
+ ((uch >= 0x84) && (uch <= 0xD3)) ||
+ ((uch >= 0xD8) && (uch <= 0xDE)) ||
+ ((uch >= 0xE0) && (uch <= 0xF9));
+ }
return false;
}