Facepunch / Rust.Community

Community Entity to fill Server Side modder requests
MIT License
46 stars 21 forks source link

JSON Parser Issue: Incomplete Handling of Special Characters #64

Open dexsper opened 1 month ago

dexsper commented 1 month ago

We've encountered a significant issue with the your JSON parser, which mishandles certain unescaped backslashes (\), quotation marks ("), or other control characters correctly. This limitation causes our UI to break entirely, requiring us to apply workarounds, such as adding extra characters. This behavior affects the reliability of our interface, and we'd appreciate an update to improve the parser’s handling of these characters to ensure compatibility and stability.

Example of JSON:

[
    {
        "name": "123",
        "parent": "Overlay",
        "destroyUi": "123",
        "components": [
            {
                "type": "UnityEngine.UI.Image",
                "color": "0 0 0 0"
            },
            {
                "type": "RectTransform",
                "offsetmax": "0 0"
            }
        ]
    },
    {
        "name": "123_1",
        "parent": "123",
        "components": [
            {
                "type": "UnityEngine.UI.Text",
                "text": "ааа\\",
                "fontSize": 20,
                "font": "robotocondensed-regular.ttf",
                "align": "MiddleLeft"
            },
            {
                "type": "RectTransform",
                "anchormin": "0 1",
                "anchormax": "0 1",
                "offsetmin": "-50 -50",
                "offsetmax": "50 50"
            }
        ]
    }
]

Originally posted by @dassjosh in https://github.com/dassjosh/Rust.UIFramework/issues/16#issuecomment-2409037909