diff options
Diffstat (limited to 'Master/texmf-dist/omega/otp/char2uni/inutf8.otp')
-rw-r--r-- | Master/texmf-dist/omega/otp/char2uni/inutf8.otp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/Master/texmf-dist/omega/otp/char2uni/inutf8.otp b/Master/texmf-dist/omega/otp/char2uni/inutf8.otp index 174c465dc00..2bbab400c42 100644 --- a/Master/texmf-dist/omega/otp/char2uni/inutf8.otp +++ b/Master/texmf-dist/omega/otp/char2uni/inutf8.otp @@ -1,9 +1,11 @@ % File inutf8.otp -% Conversion to Unicode from UTF-8 +% Conversion to UTF-16 from UTF-8 % Copyright (c) 1999 John Plaice and Yannis Haralambous +% Copyright (C) 2005, 2006 Roozbeh Pournader % This file is part of the Omega project. % -% The information was provided by Martin Duerst. +% The information was originally provided by Martin Dürst. +% Updated to incorporate exact definition of UTF-8 from Unicode 4.0. % input: 1; @@ -11,10 +13,42 @@ output: 2; expressions: +% One-byte sequences get mapped to proper ASCII @"00-@"7F => \1; -(@"C0-@"DF)(@"80-@"BF) + +% Two-byte sequences: +% U+0080..U+07FF +(@"C2-@"DF)(@"80-@"BF) => #(((\1-@"C0)*@"40) + (\2-@"80)); -(@"E0-@"EF)(@"80-@"BF)(@"80-@"BF) + +% Three-byte sequences: +% U+0800..U+0FFF +@"E0(@"A0-@"BF)(@"80-@"BF) + => #(((\2-@"80)*@"40) + (\3-@"80)); +% U+1000..U+CFFF, U+E000..U+FFFF +(@"E1-@"EC|@"EE-@"EF)(@"80-@"BF)(@"80-@"BF) => #(((\1-@"E0)*@"1000) + ((\2-@"80)*@"40) + (\3-@"80)); +% U+D000..U+D7FF +@"ED(@"80-@"9F)(@"80-@"BF) + => #(@"D000 + ((\2-@"80)*@"40) + (\3-@"80)); + +% Four-byte sequences: +% The arithmatics is a little complex here, since the characters +% are converted to UTF-16 directly. +% U+10000..U+3FFFF +@"F0(@"90-@"BF)(@"80-@"BF)(@"80-@"BF) + => #(@"D7C0 + ((\2-@"80)*4) + ((\3-@"80) div: @"10)) + #(@"DC00 + ((\3 mod: 10)*@"40) + (\4 - @"80)); +% U+40000..U+FFFFF +(@"F1-@"F3)(@"80-@"BF)(@"80-@"BF)(@"80-@"BF) + => #(@"D7C0 + ((\1-@"F0)*@"100) + ((\2-@"80)*4) + ((\3-@"80) div: @"10)) + #(@"DC00 + ((\3 mod: 10)*@"40) + (\4 - @"80)); +% U+100000..U+10FFFF +@"F4(@"80-@"8F)(@"80-@"BF)(@"80-@"BF) + => #(@"DBC0 + ((\2-@"80)*4) + ((\3-@"80) div: @"10)) + #(@"DC00 + ((\3 mod: 10)*@"40) + (\4 - @"80)); + +% Anything else gets mapped to U+FFFD. This should probably +% get replaced by an error message, instead. . => @"FFFD; |