Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
charset_util.h
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
22 
23 #ifndef PAGESPEED_KERNEL_BASE_CHARSET_UTIL_H_
24 #define PAGESPEED_KERNEL_BASE_CHARSET_UTIL_H_
25 
27 
28 namespace net_instaweb {
29 
31 const char kUtf8Charset[] = "utf-8";
32 const char kUtf16BigEndianCharset[] = "utf-16be";
33 const char kUtf16LittleEndianCharset[] = "utf-16le";
34 const char kUtf32BigEndianCharset[] = "utf-32be";
35 const char kUtf32LittleEndianCharset[] = "utf-32le";
36 
38 const char kUtf8Bom[] = "\xEF\xBB\xBF";
39 const char kUtf16BigEndianBom[] = "\xFE\xFF";
40 const char kUtf16LittleEndianBom[] = "\xFF\xFE";
41 const char kUtf32BigEndianBom[] = "\x00\x00\xFE\xFF";
42 const char kUtf32LittleEndianBom[] = "\xFF\xFE\x00\x00";
43 
61 bool StripUtf8Bom(StringPiece* contents);
62 
66 const StringPiece GetCharsetForBom(const StringPiece contents);
67 
68 }
69 
70 #endif
const StringPiece GetCharsetForBom(const StringPiece contents)
bool StripUtf8Bom(StringPiece *contents)
const char kUtf8Bom[]
The Byte-Order-Mark (BOM) for the various UTF encodings.
Definition: charset_util.h:38
const char kUtf8Charset[]
The charsets we understand. Currently only those that have BOMs below.
Definition: charset_util.h:31