Skip to content
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

Illegal characters appear when saving long markdown strings. #20

Open
acking-you opened this issue Mar 26, 2023 · 2 comments
Open

Illegal characters appear when saving long markdown strings. #20

acking-you opened this issue Mar 26, 2023 · 2 comments

Comments

@acking-you
Copy link

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.
image
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);
...
@simc
Copy link
Owner

simc commented Mar 26, 2023

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?

@acking-you
Copy link
Author

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:

uTools_1679837416719
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants