E-MailRelay
gcodepage.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gcodepage.h
19///
20
21#ifndef G_CODEPAGE_H
22#define G_CODEPAGE_H
23
24#include "gdef.h"
25#include "gstringview.h"
26
27namespace G
28{
29 namespace CodePage /// Windows codepage conversion functions.
30 {
31 std::string fromCodePage850( std::string_view s ) ;
32 ///< Converts from codepage 850 to UTF-8.
33
34 std::string toCodePage850( std::string_view s ) ;
35 ///< Converts from UTF-8 to codepage 850.
36
37 std::string fromCodePage1252( std::string_view s ) ;
38 ///< Converts from codepage 1252 to UTF-8.
39
40 std::string toCodePage1252( std::string_view s ) ;
41 ///< Converts from UTF-8 to codepage 1252.
42
43 std::string toCodePageOem( std::string_view ) ;
44 ///< Converts from UTF-8 to the active OEM codepage
45 ///< (see GetOEMCP(), 850 on unix).
46
47 std::string fromCodePageOem( std::string_view ) ;
48 ///< Converts from the active OEM codepage
49 ///< (see GetOEMCP(), 850 on unix) to UTF-8.
50
51 std::string toCodePageAnsi( std::string_view ) ;
52 ///< Converts from UTF-8 to the active "ansi" codepage
53 ///< (see GetACP(), 1252 on unix).
54
55 std::string fromCodePageAnsi( std::string_view ) ;
56 ///< Converts from the active OEM codepage
57 ///< (see GetACP(), 1252 on unix) to UTF-8.
58
59 constexpr char oem_error = '\xDB' ; // OEM error character -- full block
60 constexpr char ansi_error = '\xBF' ; // Ansi error character -- inverted question mark
61 }
62}
63
64#endif
std::string fromCodePageAnsi(std::string_view)
Converts from the active OEM codepage (see GetACP(), 1252 on unix) to UTF-8.
Definition: gcodepage.cpp:257
std::string toCodePageOem(std::string_view)
Converts from UTF-8 to the active OEM codepage (see GetOEMCP(), 850 on unix).
Definition: gcodepage.cpp:203
std::string toCodePage850(std::string_view s)
Converts from UTF-8 to codepage 850.
Definition: gcodepage.cpp:185
std::string fromCodePage1252(std::string_view s)
Converts from codepage 1252 to UTF-8.
Definition: gcodepage.cpp:191
std::string fromCodePageOem(std::string_view)
Converts from the active OEM codepage (see GetOEMCP(), 850 on unix) to UTF-8.
Definition: gcodepage.cpp:246
std::string fromCodePage850(std::string_view s)
Converts from codepage 850 to UTF-8.
Definition: gcodepage.cpp:179
std::string toCodePageAnsi(std::string_view)
Converts from UTF-8 to the active "ansi" codepage (see GetACP(), 1252 on unix).
Definition: gcodepage.cpp:214
std::string toCodePage1252(std::string_view s)
Converts from UTF-8 to codepage 1252.
Definition: gcodepage.cpp:197
Low-level classes.
Definition: garg.h:36