mssql의 ntext필드에 저장된 데이타를
TntMemoOrigin.Text:= query1.FieldByName('Body').asstring; 로 tntmemo에 불러오면 확장한자가 깨지므로
TntMemoOrigin.Text:= StringToWideString(query1.FieldByName('Body').asstring, 949);로 하면 될 줄
알았더니 확장한자는 모두 깨지는데 왜 그럴까요?
db에 저장할때는 tntmemo의 데이터를 insert문으로 입력하였습니다.
델파이 7
관련함수는 다음과 같습니다
function StringToWideString(const s: AnsiString; codePage: word): WideString;stdcall;
var l: integer;
begin
if s = '' then
Result := ''
else begin
l := MultiByteToWideChar(codePage, MB_PRECOMPOSED, PChar(@s[1]), -1, nil, 0);
SetLength(Result, l-1);
if l > 1 then
MultiByteToWideChar(CodePage, MB_PRECOMPOSED, PChar(@s[1]), -1, PWideChar(@Result[1]), l-1);
end;
end;
며칠째 고생하는 초보를 도와주시기 바랍니다.
|