Skip to content

sanitize labels - otherwise project won't save or load sometimes with 1F ASCII char #111

@binary1230

Description

@binary1230

chat:

The invalid characters thing is kinda nasty. Won't let you save your work

it actually won't let you save the project?

Yup. It does allow exporting though
Sad day when I came across that one. Wiped out several hours of work

whats an invalid character that was causing an issue? i just typed a bunch of nonsense into a label and it let me save
forgive me if you already reported this

Some US symbol, hex 1F
There's some hotkey that inserts it. Don't remember what that was now

Can't find that hotkey now, but the symbol is ␟

cool, trying to repro that.  mostly a matter of actually being able to type it. going to try and raw hex edit the file
yea i cant get it when i type it in BUT if i hexedit the file and insert 1F in there, I get it.

maybe some weird unicode interaction, the file is UTF-8 
it's the XML parser that hates it.
System.Xml.XmlException: '�', hexadecimal value 0x1F, is an invalid character. Line 20, position 46.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

I need to find a way to paste that character in to be able to catch this before it tries to serialize to XML.

I mean, even if it's an invalid label it's weird that the XML serializer can't handle it.  wonder if that's a known bug or something
it's weird because when I paste that in and save it, it shows up in its UTF-8 encoding with a few hex chars.   ugh. anyway yea i'll look into that

that's it being serialized correctly in unicode
Image

bottom line is no matter what, even if the label is garbage, it should always allow saving the project.

secondarily, we should validate labels for weird characters. ' ', or any '-' in the middle of a label are invalid asar labels, to name a few. maybe even steal asar's validation code.

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