Repository: microsoft/terminal (language: cpp)

Issue:
Conhost doesn't honour the codepage stored in shortcuts
### Windows Terminal version

n/a

### Windows build number

10.0.22621.1344

### Other Software

cmd.exe

### Steps to reproduce

1. make a shortcut to a CLI program that specifies a code page in it. [Link to documentation regarding this](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/b959e24d-67c7-4409-b52d-49c00f8bedf9)
Or use this one I made: 
[cmd-869.zip](https://github.com/microsoft/terminal/files/10873195/cmd-869.zip), for the sake of example I picked code page 869 (Greek), but it can be any code page.

2. open the shortcut and type "chcp" to check current code page.


### Expected Behavior

"chcp" returns the code page in the shortcut.
This is the behaviour if "legacy console mode" is on. (sorry I can't make the text bigger :D)
<img width="109" alt="image" src="https://user-images.githubusercontent.com/77467869/222484398-53540a6c-0255-4983-9987-8cc55eea0716.png">


### Actual Behavior

The default system code page is returned, the code page in the shortcut has no effect.
I tried setting the system code page to something other than 65001 and it still occurs, so utf-8 is not the issue here.
<img width="311" alt="image" src="https://user-images.githubusercontent.com/77467869/222485196-81c3ba8c-29a6-4be0-8be5-5e46c0814ffd.png">



Discussion / hints:
_You know what?_ I think that this assignment (L168) is backwards! 😦 

https://github.com/microsoft/terminal/blob/599b55081762af1594cd8419320e79b9be533944/src/propslib/ShortcutSerialization.cpp#L165-L170

The ones above it fill in `pStateInfo`. This one fills in the copy of `ConsoleFEData` it just loaded and is about to delete using garbage _from_ `pStateInfo`.
Thanks for the report, and great find!
Hi can I help with this issue.
@ahmad2901 absolutely! It looks like it is a quick fix -- verifying the place where we load up the codepage -- and we'd love to review a pull request for it! Let us know if you need any specific help.

Since this is in the Windows Console Host, you will be focusing mostly on the "Host.EXE" project and the projects in the same folder in our solution tree.
Sure i will get started

hey @DHowett , I am unsure how to find this error can you give some guidelines?

Fix patch:
diff --git a/src/propslib/ShortcutSerialization.cpp b/src/propslib/ShortcutSerialization.cpp
index 8c27834eeed..e930b25af83 100644
--- a/src/propslib/ShortcutSerialization.cpp
+++ b/src/propslib/ShortcutSerialization.cpp
@@ -165,7 +165,7 @@ void ShortcutSerialization::s_SetLinkPropertyDwordValue(_Inout_ IPropertyStore*
             NT_FE_CONSOLE_PROPS* pNtFEConsoleProps;
             if (SUCCEEDED(pConsoleLnkDataList->CopyDataBlock(NT_FE_CONSOLE_PROPS_SIG, reinterpret_cast<void**>(&pNtFEConsoleProps))))
             {
-                pNtFEConsoleProps->uCodePage = pStateInfo->CodePage;
+                pStateInfo->CodePage = pNtFEConsoleProps->uCodePage;
                 LocalFree(pNtFEConsoleProps);
             }
         }


Test patch: