Adding support for utf-8 text and file I/O under Windows. Requires newer Windows builds:

https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
This commit is contained in:
Richard Geldreich
2023-03-30 16:12:45 -04:00
parent c6342e51eb
commit 7f5e0ad6c2
3 changed files with 14 additions and 1 deletions

View File

@@ -228,6 +228,9 @@
<None Include="transcoder\basisu_transcoder_tables_dxt1_5.inc" />
<None Include="transcoder\basisu_transcoder_tables_dxt1_6.inc" />
</ItemGroup>
<ItemGroup>
<Manifest Include="basisu.manifest" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@@ -198,4 +198,7 @@
<UniqueIdentifier>{ab12ac82-9c39-494d-a36b-129dd1b2dec5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Manifest Include="basisu.manifest" />
</ItemGroup>
</Project>

View File

@@ -32,6 +32,10 @@
#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#include "encoder/basisu_miniz.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
// Set BASISU_CATCH_EXCEPTIONS if you want exceptions to crash the app, otherwise main() catches them.
#ifndef BASISU_CATCH_EXCEPTIONS
#define BASISU_CATCH_EXCEPTIONS 0
@@ -40,7 +44,7 @@
using namespace basisu;
using namespace buminiz;
#define BASISU_TOOL_VERSION "1.16.3"
#define BASISU_TOOL_VERSION "1.16.4"
enum tool_mode
{
@@ -4499,6 +4503,9 @@ static int main_internal(int argc, const char **argv)
int main(int argc, const char** argv)
{
#ifdef _WIN32
SetConsoleOutputCP(CP_UTF8);
#endif
#ifdef _DEBUG
printf("DEBUG\n");
#endif