-
Notifications
You must be signed in to change notification settings - Fork 49
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
json_query can not unescape ANSI #1350
Comments
Calling forth the @shawnw ! |
A negative effect of the submitted bugfix is that is can cause ansi bleeding as if one used an ansi-sub, if you have a player who is willing to be a jerk like that:
I'm looking into ways to solve that, but since this is ANSI encoding, and not MARKUP, there's no easy way to 'nicely' end the markup. |
Colorized text is an abomination unto Nuggan. |
@shawnw - Could you explain why |
I don't know why it does that. |
Ahh, that was @grapenut that did that. I should have used Git Blame. Alternatively, for me to shift json(string) from XTERM256 to MSG_MARKUP. But I think that breaks backwards compatibility, which I don't really want to risk. |
I chose to render as XTERM256 (rather than the internal Penn markup format) because that's the most acceptable format for interoperability outside of Penn. Primarily, I think that JSON being sent to HTTP servers/clients or out-of-band MUSH clients should not be using the internal Penn markup that nobody else understands. It was not a perfect solution for cases of local-only JSON use, but I think it was the right decision given the alternatives. The output that the If you change to markup instead of ANSI, your unescape method will have the same problem with color bleeding, but now additionally you'll have to deal with being able to insert any arbitrary Penn markup (including out-of-band JSON and HTML/Pueblo!), and probably causing general undefined behavior with unterminated markup sequences. I think the best solution is to not use |
To lead off - I believe you made the right decision. But coming back to the topic of making it so I can show stuff that I store in the database: The issue doesn't lie within the encoding of a string using |
Yeah it is definitely one-way. Even if you fake the JSON format and insert the raw markup, your document store is probably going to either complain or strip the control codes if they don't get encoded as unicode escapes. How about adding a wizard-only |
Yeah, I can't insert the raw markup. The unescaping you are doing to UTF8 is the only way to do this. JSON will throw a fit otherwise. unescape_markup is probably the 'cheapest' or 'easiest' way to do this. I still may keep the |
For multiple purposes, I'm making use of the json() functions when storing information.
However, when reverting the stored information, json_query's unescape does not care about ansi.
This inability to safely go back and forth is an issue that's bitten me multiple times now. And I'd like to not have to implement some weird work-arounds to make json come back with proper ansi colors.
The text was updated successfully, but these errors were encountered: