roana0229 / android-xml-sorter

Android Studio & IntelliJ Plugin for sort xml by name="xxx".
Apache License 2.0
103 stars 12 forks source link

XML entities are replaced with corresponding character #16

Closed TobiasUhmann closed 6 years ago

TobiasUhmann commented 6 years ago

I'm not sure if it's intended, but XML entities are replaced with their corresponding charachter during rearrangement.

For example, I substituted an en dash in my strings.xml with – to prevent confusion with the normal dash.

Before rearrangement:

<string name="timePeriod">27.09.2017, 10:00 &#8211; 27.09.2017, 11:00</string>

After rearrangement:

<string name="timePeriod">27.09.2017, 10:00 – 27.09.2017, 11:00</string>

Can you please include an option in the popup dialog to disable this behaviour if this is actually intended.

Thanks!

roana0229 commented 6 years ago

Hi @xvlcw

Before rearrangement:

27.09.2017, 10:00 \– 27.09.2017, 11:00

After rearrangement:

27.09.2017, 10:00 – 27.09.2017, 11:00

This is not intended. I will fix problem. But, I may take time for fix.

Thanks issue !

roana0229 commented 6 years ago

@xvlcw I investigated this and I thought not bug.

XML have "numeric character references" and "string entity references". IntelliJ IDE can't refer a part of "string entity references", and convert it to actual on default.

- and &#8211; is same mean on XML. Why do you use &#8211; (numeric character reference) ?

Example...

actual string 10 numeric 16 numeric
> &lt; &#60; &#x3C;
- &ndash; &#8211; &#x2013;

> can refer all references, and &lt;&#60;&#x3C; replaced to &lt;&lt;&lt;. - can't refer &ndash;, and &#8211;&#x2013; replaced to --.

In my opinion. Make a list of actual condition and "numeric character references" that IntelliJ IDE can't refer a part of "string entity references". Add option that actual condition convert to "numeric character references". You can solve the problem. But, all actual condition are converted. It's not good. 🤔

roana0229 commented 6 years ago

@xvlcw I will close after 3 days if no response. 😓 🙏