yw-cnv issue?

92 views
Skip to first unread message

Christian Bieck

unread,
Jan 24, 2024, 12:26:23 PMJan 24
to yWriter
Hi Peter T,
I don't have a Github acc, and figured this might be interesting to other ywriter users, too, so posting here (sorry, Simon).

Just posted this bug / issue report on the ywriter mobile forum (not visible yet):
--------
Hi,
this weekend, I ran across a strange issue with the iOS version.
My main platform where I use yWriter is Win10, but I also occasionally write on the mobile platforms, mainly iOS, syncing the files via my cloud service. I also use a bunch of Peter T's yWriter addon tools, recently yw-cnv for Import/Export to Libreoffice. Here's what happens (reproducibly).
1. I edit the yw7 file on iOS
2. Sync across platforms
3. Try to import to Libreoffice with yw-cnv on either PC or Mac
4. Get an error message "Cannot process file: <...yw7>"

If I then open the yw7 file on PC and simply close it again, the error in yw-cnv goes away, meaning it probably rewrites it in a way to make it compatible again. If step 1 is done on Android, there is no error, either. However, opening and closing the file on Android does not fix the error, only doing so on Windows does.
--------
So it looks like the iOS version does something to the yw7 file structure which makes it incompatible with your plugin, but not the app on other platforms. Any idea?

Thanks
Christian

P.S. It's not a big deal, it will only become an annoyance when I'm traveling and want to get a chapter to my writing group bc I don't have Windows access in that case.

Simon Haynes

unread,
Jan 24, 2024, 12:30:27 PMJan 24
to ywr...@googlegroups.com
The IOS version is only ever going to be guaranteed compatible with the Windows/Android versions (it uses the exact same code for load and save)

I suspect there's a field or something in the exported yw-cnv which the IOS version doesn't load in. Perhaps case sensitivity on xml fields, or a date field in a different format?

--
You received this message because you are subscribed to the Google Groups "yWriter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ywriter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ywriter/87728ba5-6902-40bb-b546-0706a6922ad0n%40googlegroups.com.


--

--
Visit Spacejock Software, the home of yWriter, FCharts and more
Visit spacejock.com.au for my articles on writing and publishing novels.

Simon Haynes

unread,
Jan 24, 2024, 12:33:35 PMJan 24
to ywr...@googlegroups.com
If you send me a copy of the original yw7 file before and after loading/saving it from IOS, offlist, I can compare the two and see what's different.


On Thu, 25 Jan 2024 at 01:26, 'Christian Bieck' via yWriter <ywr...@googlegroups.com> wrote:
--
You received this message because you are subscribed to the Google Groups "yWriter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ywriter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ywriter/87728ba5-6902-40bb-b546-0706a6922ad0n%40googlegroups.com.

Christian Bieck

unread,
Jan 24, 2024, 12:52:19 PMJan 24
to yWriter
Thanks, Simon. Mail sent via your "email me directly" link.

Peter T.

unread,
Jan 24, 2024, 1:04:44 PMJan 24
to yWriter
The way you describe it, the iOS version of yWriter seems to save the files slightly differently than the Windows version, with yw-cnv being more sensitive to the difference than yWriter.

I myself only have the Windows version of yWriter here. As long as I don't have any data, I can't find out at what point yw-cnv terminates when reading your file. It would also be helpful to know which version of yw-cnv you are using. 

Simon Haynes

unread,
Jan 24, 2024, 1:06:56 PMJan 24
to ywr...@googlegroups.com
The IOS version uses the same compiled DLL as the windows version - however, if the apple device handles something differently (unicode? a date string? colours?) then that could be the reason.


Christian Bieck

unread,
Jan 24, 2024, 1:11:03 PMJan 24
to yWriter
I use 1.38.2 of cnv. I can send you the offending iOS file if you give me an email address to send it to.
Christian

Peter T.

unread,
Jan 24, 2024, 1:13:41 PMJan 24
to yWriter
  Just a hint: The error message "Can not process file ..." means the XML parser (which is Python standard ElemenTtree) ran into a problem.
This can be an encoding problem (utf-8 is expected), or some malformed XML.

Peter T.

unread,
Jan 24, 2024, 1:20:10 PMJan 24
to yWriter
Doesn't "reply to author" work for you? I recommend to zip the yw7 file before appending it, so the encoding, line breaks, and so on. wouldn't be changed during the transfer. 
If the problem is reproducible, a small dummy project is sufficient. 

Peter T.

unread,
Jan 24, 2024, 1:50:22 PMJan 24
to yWriter
I tried a bit and realised that the Python XML parser aborts if the encoding does not match the specification in the XML header and the text contains non-ASCII characters such as umlauts.

Christian, if you want, you can try it yourself with a three-line script (just the code that produces the yw-cnv error message).
Just copy the script into the same folder as your yw7 file and start it in a command line window, like so:

try.py <your project name>.yw7

If there are any problems processing your file, you will receive a meaningful error message. 

try.py

Simon Haynes

unread,
Jan 24, 2024, 2:11:43 PMJan 24
to ywr...@googlegroups.com
That sounds likely.  Even though the file is xml, it's 'my' xml and I just read and write it as a text file. I don't use any 3rd party libraries, I parse it using my own routines.


Peter T.

unread,
Jan 24, 2024, 3:45:27 PMJan 24
to yWriter
So the XML file header is <?xml version="1.0" encoding="utf-8"?> in any case, right?
Can you tell me how the iOS yWriter variant actually encodes .yw7 files?

Christian Bieck

unread,
Jan 24, 2024, 3:55:55 PMJan 24
to yWriter
Tried to send a file directly, didn't it work?
Attaching an iOS one here.

iOS_test.zip

Peter T.

unread,
Jan 24, 2024, 4:36:18 PMJan 24
to yWriter
Thanks, Christian, I just got it. it is UTF-16 encoded, but the file header says "utf-8". That's the reason why yw-cnv aborts.
The best solution would be to fix this in the iOS version of yWriter.

Cheers, 
Peter

Simon Haynes

unread,
Jan 25, 2024, 2:01:45 AMJan 25
to ywr...@googlegroups.com
I've passed the comments onto the IOS developer. It's possible Apple uses UTF-16 internally, but UTF-8 should be fine.


Christian Bieck

unread,
Jan 25, 2024, 4:05:38 AMJan 25
to yWriter
Thanks Simon, Peter!

Peter T.

unread,
Jan 25, 2024, 5:00:05 AMJan 25
to yWriter
In any case, utf-8 saves half the memory required by utf-16 encoded files, so fixing this bug is worthwhile.

However, I have modified yw-cnv so that it can also read the submitted test file. Simply update via the LibreOffice Extension Manager and give me a feedback whether it works for you. 

Christian Bieck

unread,
Jan 25, 2024, 8:13:06 AMJan 25
to yWriter
It does.
Danke, Peter.
Reply all
Reply to author
Forward
0 new messages