Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
574 B

  1. //
  2. // misc.c
  3. //
  4. #include "private.h"
  5. #include "immif.h"
  6. #pragma warning(disable: 4005)
  7. #include <wingdip.h>
  8. BYTE GetCharsetFromLangId(LCID lcid)
  9. {
  10. CHARSETINFO csInfo;
  11. if (!TranslateCharsetInfo((DWORD *)(ULONG_PTR)lcid, &csInfo, TCI_SRCLOCALE))
  12. return DEFAULT_CHARSET;
  13. return (BYTE) csInfo.ciCharset;
  14. }
  15. UINT GetCodePageFromLangId(LCID lcid)
  16. {
  17. TCHAR buf[8]; // maxmum may be six
  18. if (GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, buf, ARRAYSIZE(buf))) {
  19. return _ttoi(buf);
  20. }
  21. return CP_ACP;
  22. }