-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpyregf_codepage.c
138 lines (102 loc) · 3.18 KB
/
pyregf_codepage.c
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* Codepage functions
*
* Copyright (C) 2009-2024, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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 Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <common.h>
#include <types.h>
#include "pyregf_codepage.h"
#include "pyregf_libregf.h"
/* Returns a string representation of the codepage
* Codecs and aliases are defined: http://docs.python.org/library/codecs.html#standard-encodings
* Returns 1 if successful or NULL if codepage is not supported
*/
const char *pyregf_codepage_to_string(
int codepage )
{
switch( codepage )
{
case LIBREGF_CODEPAGE_ASCII:
return( "ascii" );
case LIBREGF_CODEPAGE_ISO_8859_1:
return( "iso-8859-1" );
case LIBREGF_CODEPAGE_ISO_8859_2:
return( "iso-8859-2" );
case LIBREGF_CODEPAGE_ISO_8859_3:
return( "iso-8859-3" );
case LIBREGF_CODEPAGE_ISO_8859_4:
return( "iso-8859-4" );
case LIBREGF_CODEPAGE_ISO_8859_5:
return( "iso-8859-5" );
case LIBREGF_CODEPAGE_ISO_8859_6:
return( "iso-8859-6" );
case LIBREGF_CODEPAGE_ISO_8859_7:
return( "iso-8859-7" );
case LIBREGF_CODEPAGE_ISO_8859_8:
return( "iso-8859-8" );
case LIBREGF_CODEPAGE_ISO_8859_9:
return( "iso-8859-9" );
case LIBREGF_CODEPAGE_ISO_8859_10:
return( "iso-8859-10" );
case LIBREGF_CODEPAGE_ISO_8859_11:
return( "iso-8859-11" );
case LIBREGF_CODEPAGE_ISO_8859_13:
return( "iso-8859-13" );
case LIBREGF_CODEPAGE_ISO_8859_14:
return( "iso-8859-14" );
case LIBREGF_CODEPAGE_ISO_8859_15:
return( "iso-8859-15" );
case LIBREGF_CODEPAGE_ISO_8859_16:
return( "iso-8859-16" );
case LIBREGF_CODEPAGE_KOI8_R:
return( "koi8_r" );
case LIBREGF_CODEPAGE_KOI8_U:
return( "koi8_u" );
case LIBREGF_CODEPAGE_WINDOWS_874:
return( "cp874" );
case LIBREGF_CODEPAGE_WINDOWS_932:
return( "cp932" );
case LIBREGF_CODEPAGE_WINDOWS_936:
return( "cp936" );
case LIBREGF_CODEPAGE_WINDOWS_949:
return( "cp949" );
case LIBREGF_CODEPAGE_WINDOWS_950:
return( "cp950" );
case LIBREGF_CODEPAGE_WINDOWS_1250:
return( "cp1250" );
case LIBREGF_CODEPAGE_WINDOWS_1251:
return( "cp1251" );
case LIBREGF_CODEPAGE_WINDOWS_1252:
return( "cp1252" );
case LIBREGF_CODEPAGE_WINDOWS_1253:
return( "cp1253" );
case LIBREGF_CODEPAGE_WINDOWS_1254:
return( "cp1254" );
case LIBREGF_CODEPAGE_WINDOWS_1255:
return( "cp1255" );
case LIBREGF_CODEPAGE_WINDOWS_1256:
return( "cp1256" );
case LIBREGF_CODEPAGE_WINDOWS_1257:
return( "cp1257" );
case LIBREGF_CODEPAGE_WINDOWS_1258:
return( "cp1258" );
default:
break;
}
return( NULL );
}