LoginSignup
0
0

More than 5 years have passed since last update.

C++ Builder > code page > 1252 > used by default in the legacy components of Microsoft Windows in English

Posted at
動作環境
C++ Builder XE4

https://edn.embarcadero.com/article/39387
のQC# 67686

Description(抜粋):

...
Internally, Lowercase() and UpperCase() are not initializing the ECX register (which is used to hold the target codepage for the new string memory) when calling System.@LStrSetLength(), so whatever random value was already in ECX gets used as the codepage.

Steps:

uses AnsiStrings; var astr : AnsiString; ustr : UnicodeString; cp: Word; begin astr := AnsiStrings.LowerCase('ABCDE'); cp := StringCodePage(astr); // <-- expected 0 or 1252, got random value instead ustr := astr; // <-- conversion to UTF-16 fails, ustr ends up with empty data end;

code page 1252は何か。

Windows-1252 or CP-1252 (code page – 1252) is a 1 byte character encoding of the Latin alphabet, used by default in the legacy components of Microsoft Windows in English and some other Western languages (other languages use different default encodings).

英語版のWindowsにおいて使われているデフォルトのコードページなのだろう。

日本語版でテストしても不具合の再現は難しいかもしれない。

LowerCase()もしくはUpperCase()を使用したときにLStrSetLength()がコールされ、それによる不具合が発生しているのだろうか。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0