AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi TJson.Format und Umlaute
Thema durchsuchen
Ansicht
Themen-Optionen

TJson.Format und Umlaute

Ein Thema von Codehunter · begonnen am 2. Sep 2019 · letzter Beitrag vom 2. Sep 2019
 
Schokohase
(Gast)

n/a Beiträge
 
#4

AW: TJson.Format und Umlaute

  Alt 2. Sep 2019, 09:42
Also wenn wir davon reden, was Delphi da mittels TJson veranstaltet, dann müssen wir auch über die JSON-Spezifikation sprechen, denn das war die Grundlage für die Funktionsweise von TJson .

Das Delphi einen "normalen" string als Ergebnis zurückliefert, ja das sollte klar sein. Allerdings sollten sich nach dem TJson.Format nur noch Zeichen befinden, die sich auch in der UTF8-Zeichentabelle befinden.

Und warum sollte da etwas escaped werden, wenn es nicht escaped werden muss (das Zeichen ist in der UTF8-Zeichentabelle enthalten).

Ansonsten, welche Zeichen sollen denn alle escaped werden? Alle? Einige? Nach welchen Kriterien?

Aber eventuell hilft dir auch noch die Beschreibung aus der RFC
Zitat:
Code:
2.5. Strings

   The representation of strings is similar to conventions used in the C
   family of programming languages. A string begins and ends with
   quotation marks. All Unicode characters may be placed within the
   quotation marks except for the characters that must be escaped:
   quotation mark, reverse solidus, and the control characters (U+0000
   through U+001F).

   Any character may be escaped. If the character is in the Basic
   Multilingual Plane (U+0000 through U+FFFF), then it may be
   represented as a six-character sequence: a reverse solidus, followed
   by the lowercase letter u, followed by four hexadecimal digits that
   encode the character's code point. The hexadecimal letters A though
   F can be upper or lowercase. So, for example, a string containing
   only a single reverse solidus character may be represented as
   "\u005C".

   Alternatively, there are two-character sequence escape
   representations of some popular characters. So, for example, a
   string containing only a single reverse solidus character may be
   represented more compactly as "\\".

   To escape an extended character that is not in the Basic Multilingual
   Plane, the character is represented as a twelve-character sequence,
   encoding the UTF-16 surrogate pair. So, for example, a string
   containing only the G clef character (U+1D11E) may be represented as
   "\uD834\uDD1E".
(Quelle: https://www.ietf.org/rfc/rfc4627.txt)
Daraus geht hervor, was escaped werden muss, und was escaped werden darf.

PS

Mich dünkt du hast ein anderes Problem und versuchst dieses nun dem JSON in die Schuhe zu schieben.

Geändert von Schokohase ( 2. Sep 2019 um 09:45 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:36 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz