// Copyright 2013 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Routine that maps a Unicode code point to an interchange-valid one // // Table that maps MS CP1252 bytes 00-FF to their corresponding Unicode // code points. C0 and C1 control codes that are not interchange-valid // are mapped to spaces. #ifndef SCRIPT_SPAN_FIXUNICODEVALUE_H_ #define SCRIPT_SPAN_FIXUNICODEVALUE_H_ #include "integral_types.h" // for char32 #include "port.h" namespace chrome_lang_id { namespace CLD2 { // Map byte value 0000-00FF to char32 // Maps C0 control codes (other than CR LF HT FF) to space [29 instances including DEL=0x7F] // Maps C1 control codes to CP1252 [27 instances] or space [5 instances] static const char32 kMapFullMicrosoft1252OrSpace[256] = …; // Guarantees that the resulting output value is interchange valid // 00-FF; map to spaces or MS CP1252 // D800-DFFF; surrogates // FDD0-FDEF; non-characters // xxFFFE-xxFFFF; non-characters char32 FixUnicodeValue(char32 uv); } // End namespace CLD2 } // End namespace chrome_lang_id #endif // SCRIPT_SPAN_FIXUNICODEVALUE_H_