Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non encoding above 127 ASCII if is UTF-8 #20

Open
Dzyszla opened this issue Nov 27, 2024 · 0 comments
Open

Non encoding above 127 ASCII if is UTF-8 #20

Dzyszla opened this issue Nov 27, 2024 · 0 comments

Comments

@Dzyszla
Copy link

Dzyszla commented Nov 27, 2024

Proposal for modify middleware to no encoding above 127 ASCII char code:

var
procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED(FPC)}TNextProc{$ELSE}TProc{$ENDIF});
  ...
  ops: TJSONValue.TJsonOutputOptions;
begin
 ...
	  if SameText(Charset, 'utf-8') then
		ops := [TJSONValue.TJSONOutputOption.EncodeBelow32]
	  else
		ops := [TJSONValue.TJSONOutputOption.EncodeBelow32, TJSONValue.TJSONOutputOption.EncodeAbove127];

	  Res.RawWebResponse.Content := TJSONValue(Res.Content).ToJSON(ops);
...
end;

Or maybe some other configuration for this? If I want to response with utf-8 charset, why can't use utf-8 charset as is in json?

(this feature can support only by D12 (or some lower, but above D10).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant