From 21b0032fb821e0eb0f4e700c872a0ed47b1d26d3 Mon Sep 17 00:00:00 2001 From: maxpat78 Date: Wed, 7 Jun 2023 11:13:40 +0200 Subject: [PATCH] Update dos_programs.cpp Insert back changes from pull request #4299 (Fixed garbled characters when using DBCS strings in title command), already merged in the main trunk but erased (by mistake) due to my latest VHDMAKE commits. --- src/dos/dos_programs.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 5ce58de5634..2295049fd0e 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -7741,6 +7741,8 @@ class TITLE : public Program { } }; +bool CodePageGuestToHostUTF8(char *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/); + void TITLE::Run() { // Hack To allow long commandlines @@ -7751,8 +7753,13 @@ void TITLE::Run() PrintUsage(); return; } - char *args=(char *)cmd->GetRawCmdline().c_str(); - dosbox_title=trim(args); + char *args=trim((char *)cmd->GetRawCmdline().c_str()); + char title[4096]; + if(CodePageGuestToHostUTF8(title, args)) { + dosbox_title=title; + } else { + dosbox_title=args; + } SetVal("dosbox", "title", dosbox_title); GFX_SetTitle(-1,-1,-1,false); }