1 /****************************************************************************** 2 * 3 * Copyright (C) 2003-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * UTF conversion utilities. 22 * 23 ******************************************************************************/ 24 #ifndef UTFC_H 25 #define UTFC_H 26 27 #ifdef __cplusplus 28 extern "C" 29 { 30 #endif 31 32 /******************************************************************************* 33 ** 34 ** Function utfc_16_to_8 35 ** 36 ** Description Convert a UTF-16 array to a null-terminated UTF-8 string. 37 ** Illegal characters are skipped. 38 ** 39 ** Returns Length of UTF-8 string in bytes. 40 ** 41 *******************************************************************************/ 42 extern UINT16 utfc_16_to_8(UINT8 *p_utf8, UINT16 utf8_len, UINT16 *p_utf16, UINT16 utf16_len); 43 44 /******************************************************************************* 45 ** 46 ** Function utfc_8_to_16 47 ** 48 ** Description Convert a null-terminated UTF-8 string to a UTF-16 array. 49 ** Illegal characters are skipped. The UTF-16 array is 50 ** appended with a zero (null) character. 51 ** 52 ** Returns Length of UTF-16 array including null character. 53 ** 54 *******************************************************************************/ 55 extern UINT16 utfc_8_to_16(UINT16 *p_utf16, UINT16 utf16_len, UINT8 *p_utf8); 56 57 #ifdef __cplusplus 58 } 59 #endif 60 61 #endif /* UTFC_H */ 62