PasaOpasen / toml-union

Script to union several *.toml files (usually Poetry pyproject.toml) to simplify manual dependences resolving
MIT License
10 stars 1 forks source link

Unexpected handling of unicode when combining files #1

Open katettudelft opened 10 months ago

katettudelft commented 10 months ago

Hello,

I saw some unexpected behaviour when combining two files together via your docker image.

Here's an example:

File 1:

[aws]
symbol = "  "

File 2:

[aws]
format = '\[[$symbol($profile)(\($region\))(\[$duration\])]($style)\]'

I'd expected a result like this:

[aws]
format = '\[[$symbol($profile)(\($region\))(\[$duration\])]($style)\]'
symbol = "  "

But actually got:

[aws]
format = "\\[[$symbol($profile)(\\($region\\))(\\[$duration\\])]($style)\\]"
symbol = "\ue33d  "

As you can see, " " is converted to "\ue33d ". Any ideas on what might be causing this?

For context, I'm trying to merge two Starship Presets together, which make use of the unicode glyphs from Nerd Fonts.

The preset files are a lot longer than my examples, which is why I was so pleased to see your repo! It'll be a hell of a timesaver. :)

PasaOpasen commented 9 months ago

@katettudelft I think it is some coding error, will check later

What is your OS?

PasaOpasen commented 9 months ago

Maybe be docker image does not have latest version, did u try to just use python?

katettudelft commented 9 months ago

My OS is Linux Mint 21.2, but like I said, I used the docker image. I didn't try to use the python code directly, no.

PasaOpasen commented 9 months ago

@katettudelft these were some encoding troubles in the library

Now u can try it with flag --unicode-escape and it will work

katettudelft commented 9 months ago

Thanks, I'll try it out as soon as I get chance.