-
Notifications
You must be signed in to change notification settings - Fork 2
/
CharsetUtils.h
47 lines (40 loc) · 1.77 KB
/
CharsetUtils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Copyright (C) 2005-2008 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include <string>
#include <string.h>
#ifdef _MSC_VER
#include "vc_project/libiconv/include/iconv.h"
#else
#include <iconv.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#define ICONV_PREPARE(iconv) iconv=(iconv_t)-1
#define UTF8_DEST_MULTIPLIER 6
std::string ToUTF8(const std::string& strEncoding, const std::string& str);
void stringCharsetToUtf8(const std::string& strSourceCharset, const std::string& strSource,
std::string& strDest);
void convert(iconv_t& type, int multiplier, const std::string& strFromCharset,
const std::string& strToCharset, const std::string& strSource, std::string& strDest);
bool convert_checked(iconv_t& type, int multiplier, const std::string& strFromCharset,
const std::string& strToCharset, const std::string& strSource,
std::string& strDest);
size_t iconv_const (void* cd, const char** inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);