Dev-Cpp
Dev-Cpp copied to clipboard
[JA] Languages
When I change the language to Japanese, the characters are garbled. ([Tool | Environment Options...] > [General] Tab -> "Language:" )
This problem occurs because the code page cannot get from the language file.
[MultiLangSupport.pas]
procedure TdevMultiLangSupport.Open(const Filename: String);
var
LangFile: String;
begin
// Load file from languages directory
LangFile := ValidateFile(Filename, devDirs.Lang);
if LangFile = '' then begin
MessageDlg('Could not open language file ' + Filename, mtError, [mbOK], 0);
Exit;
end;
// Load file into fStrings
fStrings.LoadFromFile(LangFile,TEncoding.ANSI);
fLangFile := LangFile;
// Get languange
fCurLang := fStrings.Values['Lang'];
if fCurLang = '' then
fCurLang := ChangeFileExt(ExtractFileName(LangFile), '');
fCurCodePage := GetCodePage(fCurLang); // <- Here
devData.Language := ExtractFileName(LangFile);
end;
[MultiLangSupport.pas]
Encodings: Array[0..MaxEncodings - 1] of TCPData =
(
...
//(CPID: 866; CPName: 'cp866'),
//(CPID: 869; CPName: 'ibm869'),
//(CPID: 870; CPName: 'IBM870'),
//(CPID: 874; CPName: 'windows-874'),
//(CPID: 875; CPName: 'cp875'),
(CPID: 932; CPName: 'shift_jis'; CPLang: 'Japanese';), // <- Here
(CPID: 936; CPName: 'gb2312'; CPLang: 'Chinese';),
(CPID: 949; CPName: 'ks_c_5601-1987'; CPLang: 'Korean';),
//(CPID: 950; CPName: 'big5'),
//(CPID: 1026; CPName: 'IBM1026'),
//(CPID: 1047; CPName: 'IBM01047'),
//(CPID: 1140; CPName: 'IBM01140'),
//(CPID: 1141; CPName: 'IBM01141'),
...
If Lang in the language file is changed to “Japanese”, garbled characters will not occur.
[lang]
Lang=日本語
Ver=1
1=ファイル(&F)
2=編集(&E)
...
↓
[lang]
Lang=Japanese (日本語)
Ver=1
1=ファイル(&F)
2=編集(&E)
...