AuroraRuntime/Source/Locale/Encoding/EncoderIConv.cpp

39 lines
1.2 KiB
C++
Raw Normal View History

2021-09-06 10:58:08 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: EncoderIConv.cpp
Date: 2021-8-19
Author: Reece
***/
2021-09-30 14:57:41 +00:00
#include <Source/RuntimeInternal.hpp>
2021-09-06 10:58:08 +00:00
#include "../Locale.hpp"
#include "Encoding.hpp"
#include "EncoderIConv.hpp"
namespace Aurora::Locale::Encoding
{
static void SanitizeIConvCharset(AuString &str)
{
if (AuStartsWith(str, "MS-"))
2022-01-26 04:47:32 +00:00
{
str = "WINDOWS-" + str.substr(3);
2022-01-26 04:47:32 +00:00
return;
}
str = AuToUpper(str);
if (AuStartsWith(str, "LATIN"))
{
// Maybe a BST could do this faster. Dont want hashstring jump table. Meh, it'll do.
if (str == "LATIN-1") str = "LATIN1";
else if (str == "LATIN-9") str = "LATIN9";
else if (str == "LATIN-2") str = "LATIN2";
else if (str == "LATIN-3") str = "LATIN3";
else if (str == "LATIN-4") str = "LATIN4";
else if (str == "LATIN-5") str = "LATIN5";
else if (str == "LATIN-6") str = "LATIN6";
else if (str == "LATIN-7") str = "LATIN7";
else if (str == "LATIN-8") str = "LATIN8";
}
}
}