#1 mORMot 1 » UTF8 problem on TJSONWriter » 2015-10-29 01:48:06

dollee
Replies: 1

my code is

program UTF8Test;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  SynCommons;

var
  AJSON: TJSONWriter;
  AUTF8Text,
  AUTF8Result: RawUTF8;
begin
  try
     AJSON := TJSONWriter.CreateOwnedStream;
     try
        AUTF8Text := '한글(Korean), 日本語(Japanese) Test';
        AJSON.Add('{');
        AJSON.AddFieldName('utf8');
        AJSON.AddJSONEscape(Pointer(AUTF8Text));
        AJSON.Add('}');

        AUTF8Result := AJSON.Text;
     finally
        AJSON.Free;
     end;

     Writeln(AUTF8Result);
     Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

result:

{"utf8":﨑懋ク'#$80'(Korean), 譌・譛ャ隱・Japanese) Test}

how can i do?

#2 mORMot 1 » mORMoti18n.pas compile problem on dbcs os system (like korean o/s)... » 2013-01-03 06:57:10

dollee
Replies: 1

mORMoti18n.pas

original

procedure CRLF(P: PChar); // PChar = either PAnsiChar either PWideChar
begin
  repeat
    case P^ of
    #0: exit;
    '|': P^ := #13;
    '¤': P^ := #10; 
    end;
    inc(P);
  until false;
end;

modified

procedure CRLF(P: PChar); // PChar = either PAnsiChar either PWideChar
begin
  repeat
    case P^ of
    #0: exit;
    '|': P^ := #13;
    #164 : P^ := #10;   // ¤
    end;
    inc(P);
  until false;
end;

sorry my english...

#3 mORMot 1 » found error in TSQLRestClientURI.Commit and TSQLRestClientURI.rollback » 2012-11-20 08:41:27

dollee
Replies: 1
  FDBClient := TSQLIte3HttpClient.Create('localhost', '8080', FSQLModel);

  ASessionID := GetCurrentThreadID;
  FDBClient.TransactionBegin(TAPM_STRING_DATA, ASessionID);
  try
  
    …
    …
    FDBClient.Commit(ASessionID);  // <-- it dosen't work!!! TSQLite3HttpClient.TransactionBegin accept session id only "1"!!!
  except
    FDBClient.Rollback(ASessionID);  // <-- it dosen't work!!! TSQLite3HttpClient.TransactionBegin accept session id only "1"!!!
  end;

fixed code

procedure TSQLRestClientURI.RollBack(SessionID: cardinal);
begin
//  inherited Rollback(SessionID); // reset fTransactionActive flag
  inherited Rollback(CONST_AUTHENTICATION_NOT_USED);   // <-- fixed
  URI(Model.Root,'ABORT');
end;

procedure TSQLRestClientURI.Commit(SessionID: cardinal);
begin
//  inherited Commit(SessionID); // reset fTransactionActive flag
  inherited Commit(CONST_AUTHENTICATION_NOT_USED);    // <-- fixed
  URI(Model.Root,'END');
end;

Board footer

Powered by FluxBB