Illegal characters appear when saving long markdown strings.
I want to save markdown text as json file, I first encode the text by base64 and then convert it to json string by this library. But I found that if the markdown file is a little bit more complex, it produces the effect in the picture below.
Even so, the library can still parse the data correctly, I'm not sure if this is a bug or not.
Here is my class code:
@json
class Content {
@jsonIgnore
Id id = Isar.autoIncrement;
String title = "";
Category category = Category();
Book book = Book();
String? detail;
}
Here is the code I used for serialization:
...
final writer = CrimsonWriter();
final contents = await Content.allContent();
ContentBase64Encode(contents);
writer.writeContentOrNullList(contents);
...
Here is the code I used for deserialization:
...
final crimson = Crimson(await file.readAsBytes());
final contents = crimson.readContentOrNullList();
ContentBase64Decode(contents);
...
That's very weird. I use Crimson a lot myself and never seen something like that.
Is it possible to provide a small runnable example?
That's very weird. I use Crimson a lot myself and never seen something like that.
Is it possible to provide a small runnable example?
I created a repository reproduction and wrote a simple example code. github.com/ACking-you/example_code
descript
When I save more complex markdown text, it will trigger the following bug:
At this point in time the editor will think it is a binary file, the above image is forced to show the appearance of the text.
environment
Compiled environment for the demo:Windows 11