39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: EncoderIConv.cpp
|
|
Date: 2021-8-19
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "../Locale.hpp"
|
|
#include "Encoding.hpp"
|
|
#include "EncoderIConv.hpp"
|
|
|
|
namespace Aurora::Locale::Encoding
|
|
{
|
|
static void SanitizeIConvCharset(AuString &str)
|
|
{
|
|
if (AuStartsWith(str, "MS-"))
|
|
{
|
|
str = "WINDOWS-" + str.substr(3);
|
|
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";
|
|
}
|
|
}
|
|
} |