Skip to content

Request.Body encoding bug #36

@feelple

Description

@feelple

example data, charset utf-8
[{"barcode":"8801062318490","company_code":"민","quantity":5,"date":"2016-03-23","kind":"1"}]

"민" is korean.

error message
[EEncodingError] No mapping for the Unicode character exists in the target multi-byte code page

> original code
function TMVCWebRequest.Body: string;
....
  try
    Result := InEnc.GetString(TEncoding.ANSI.GetBytes(FWebRequest.RawContent));
  finally
    InEnc.Free;
  end
....

> my code
function TMVCWebRequest.Body: string;
....
  try
    SetLength(Buffer, FWebRequest.ContentLength);
    FWebRequest.ReadClient(Buffer[0], FWebRequest.ContentLength);

    Result := InEnc.GetString(Buffer);
  finally
    InEnc.Free;
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions