simpletask-android icon indicating copy to clipboard operation
simpletask-android copied to clipboard

UTF-8 BOM bug

Open t214c opened this issue 5 years ago • 6 comments

Steps to reproduce:

  • Create some tasks.
  • Set Priority A to the first. It will show (A) in red at the beginning of the line.
  • In a text editor (e.g. on PC). Convert the file to UTF-8 with BOM.
  • Reopen the task list.

Expected behavior:

  • Nothing should change.

Current behavior:

  • (A) becomes normal color. This suggest that the byte order mark is not treated by Simpletask as separate from the following character: the left parenthesis of (A); thus not recognizing it as a priority indicator.

t214c avatar Jul 01 '19 16:07 t214c

@t214c Java always assumes a UTF-8 string does not have a BOM. Why do you need the BOM at all?

Reading (and ignoring) the BOM might be implemented. Writing the file back with BOM probably not. See for example https://stackoverflow.com/questions/2223882/whats-the-difference-between-utf-8-and-utf-8-without-bom/2223926#2223926 for some reasons.

mpcjanssen avatar Jul 02 '19 10:07 mpcjanssen

Editing the file on PC. Many text editors don't recognize UTF-8 if it didn't have a BOM. Multi-byte characters are interpreted wrong as separate 8-bit characters.

What I want is at least don't revert the BOM back when editing the file.

Thanks :)

t214c avatar Jul 02 '19 15:07 t214c

That is exactly what I wouldn't want to do as it requires tracking state. I could at a setting use UTF-8 with BOM so it always writes a BOM. I do consider applications that need a BOM to handle UTF-8 properly broken BTW.

mpcjanssen avatar Jul 03 '19 10:07 mpcjanssen

That is exactly what I wouldn't want to do as it requires tracking state.

I'm not sure I follow. Couldn't it be a simple If function? or just appending the file without modifying the early bytes (BOM or no BOM)?

I could at a setting use UTF-8 with BOM so it always writes a BOM.

That would be a good solution :)

I do consider applications that need a BOM to handle UTF-8 properly broken BTW.

:) I am aware of the debate. But practical situations sometimes force one's hand. No text editor checks all the boxes. On my machine, the ones that handle UTF-8 well are slow or can't handle big files, for example.

In a better world, we would have clear standards followed by everyone, but what I found best (or least painful), is to use customizable software that one can make fit into their own puzzle of a work flow. That comes at the expense of nice devs, unfortunately, for which I am grateful! :)

t214c avatar Jul 03 '19 12:07 t214c

Recommend closing/rejecting. IMHO BOM support isn't reasonable, use a decent/modern text editor to avoid issues on PC.

clach04 avatar Sep 10 '22 21:09 clach04

@clach04 I don't feel the need to clean up open issues. I don't have a manager pushing an open issues KPI :) For @t214c this is a valid concern and I appreciate that. However I don't think I am going to implement this (hence the someday/maybe tag)

mpcjanssen avatar Sep 11 '22 06:09 mpcjanssen