• R/O
  • SSH

wp2latex: Commit

WP2LaTeX sources.


Commit MetaInfo

Revisioncf7b2c25d053c195efc873eb2b61086e1a4e8cc2 (tree)
Time2021-10-13 07:04:29
AuthorFojtik
CommiterFojtik

Log Message

Switch Windows console to UTF8 when localisation is in UTF8.

Change Summary

Incremental Difference

diff -r 39129de3df99 -r cf7b2c25d053 trunk/msvc/FixCon2UTF8.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/msvc/FixCon2UTF8.c Wed Oct 13 00:04:29 2021 +0200
@@ -0,0 +1,14 @@
1+#include <io.h>
2+#include <fcntl.h>
3+#include <Windows.h>
4+#include <WinCon.h>
5+
6+#include <stdio.h>
7+
8+
9+void FixConsole2UTF8(void)
10+{
11+ SetConsoleOutputCP(CP_UTF8);
12+ //_setmode(_fileno(stdout), _O_U8TEXT);
13+ //printf("Konverze pøepnuta na UTF8!");
14+}
\ No newline at end of file
diff -r 39129de3df99 -r cf7b2c25d053 trunk/msvc/wp2latex.vcproj
--- a/trunk/msvc/wp2latex.vcproj Tue Oct 12 14:05:10 2021 +0200
+++ b/trunk/msvc/wp2latex.vcproj Wed Oct 13 00:04:29 2021 +0200
@@ -52,7 +52,7 @@
5252 Name="VCCLCompilerTool"
5353 Optimization="0"
5454 AdditionalIncludeDirectories="..\sources.cc\atoms\include;..\sources.cc;..\sources.cc\cp_lib;..\..\localiser;E:\libs\src\jpeg;&quot;E:\libs\src\libpng\1.2.37\libpng-1.2.37-src\&quot;;&quot;E:\libs\src\zlib\1.2.3\zlib-1.2.3\&quot;"
55- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_USE_PNG;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS"
55+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__gettext__;_USE_PNG;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;POINTER_SIZE=32;USE_TEMP_STRINGS"
5656 BasicRuntimeChecks="3"
5757 RuntimeLibrary="1"
5858 UsePrecompiledHeader="0"
@@ -82,7 +82,7 @@
8282 OutputFile=".\Win32_Debug_PNG_Gtxt/wp2latex.exe"
8383 LinkIncremental="1"
8484 SuppressStartupBanner="true"
85- AdditionalLibraryDirectories="..\..\localiser\Release;E:\libs\src\jpeg\MSVC2008\Debug;&quot;E:\libs\src\libpng\1.2.37\libpng-1.2.37-src\projects\visualc6\Win32_LIB_Release&quot;"
85+ AdditionalLibraryDirectories="..\..\localiser\Debug;E:\libs\src\jpeg\MSVC2008\Debug;&quot;E:\libs\src\libpng\1.2.37\libpng-1.2.37-src\projects\visualc6\Win32_LIB_Release&quot;"
8686 IgnoreDefaultLibraryNames="libc.lib"
8787 GenerateDebugInformation="true"
8888 ProgramDatabaseFile=".\Win32_Debug_PNG_Gtxt/wp2latex.pdb"
@@ -3055,6 +3055,10 @@
30553055 Name="Support"
30563056 >
30573057 <File
3058+ RelativePath=".\FixCon2UTF8.c"
3059+ >
3060+ </File>
3061+ <File
30583062 RelativePath="..\sources.cc\jobs\jobs.cc"
30593063 >
30603064 </File>
diff -r 39129de3df99 -r cf7b2c25d053 trunk/sources.cc/igettext.cc
--- a/trunk/sources.cc/igettext.cc Tue Oct 12 14:05:10 2021 +0200
+++ b/trunk/sources.cc/igettext.cc Wed Oct 13 00:04:29 2021 +0200
@@ -94,7 +94,8 @@
9494 (line[i]!='\\')|| (line[i]!=':')) temp+=line[i];
9595 else break;
9696 }
97- if(!temp.isEmpty()) putenv(temp.ExtractString()); //The string must not be released!!!
97+ if(!temp.isEmpty())
98+ putenv(temp.ExtractString()); //The string must not be released!!!
9899 //puts(temp.ch);
99100 }
100101 fclose(f);
@@ -171,8 +172,19 @@
171172 }
172173 bindtextdomain(GtxtDomain, ProgPath());
173174
174- Empty2Info = _(GET_LOCALE_INFO); //when gettext is active "" is expanded to the localisation details
175+ Empty2Info = _(GET_LOCALE_INFO); //when gettext is active "" is expanded to the localisation details
175176 }
177+
178+#ifdef _MSC_VER
179+ if(Empty2Info!=NULL && *Empty2Info!=0)
180+ {
181+ //printf("%s",Empty2Info);
182+ if(strstr(Empty2Info,"charset=UTF-8")!=NULL)
183+ {
184+ FixConsole2UTF8();
185+ }
186+ }
187+#endif
176188 }
177189
178190
Show on old repository browser