Ask Your Question

strange 1st character when saving as text (solved)

asked 2017-04-08 17:20:52 +0200

Pansmanser gravatar image

updated 2017-04-08 18:04:30 +0200

Very strange behaviour! When I open any .odt file and save as .txt, the first character of the first line is asc(65279) (zero-width no-break space). Any reason for this? Can I prevent it? A bug?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-04-08 18:03:56 +0200

Pansmanser gravatar image

Thank you Mike. I was just coming back to say I had discovered that, but you beat me to it. Since I was trying to do this in a basic macro, the code is:

oArgs(0).name = "Overwrite" : oArgs(0).value = true
oArgs(1).Name = "FilterName" : oArgs(1).Value = "Text (encoded)"
oArgs(2).Name = "FilterOptions" : oArgs(2).Value = "ASCII_US,LF,,,"
StarDesktop.getCurrentComponent().StoreAsUrl(ConvertToUrl(sFileName), oArgs)
edit flag offensive delete link more

answered 2017-04-08 17:52:22 +0200

updated 2017-04-08 17:57:19 +0200

You cannot use UTF8/UTF16 and avoid BOM. Only if your text is ASCII/US, you may use that encoding and get the same bytes as UTF8 without BOM.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-08 17:20:52 +0200

Seen: 36 times

Last updated: Apr 08 '17