Search code examples
delphidelphi-7unicode-stringwidecharmultibyte-functions

Combine two Bytes to WideChar


Is it possible to combine two Bytes to WideChar and if yes, then how?
For example, letter "ē" in binary is 00010011 = 19 and 00000001 = 1, or 275 together.

var
  WChar: WideChar;
begin
  WChar := WideChar(275); // Result is "ē"


var
  B1, B2: Byte;
  WChar: WideChar;
begin
  B1 := 19;
  B2 := 1;
  WChar := CombineBytesToWideChar(B1, B2); // ???

How do I get WideChar from two bytes in Delphi?


Solution

  • WChar := WideChar(MakeWord(B1, B2));