Page 1 of 1
[Solved] Insert file with "problem" characters in Writer
Posted: Thu Nov 13, 2025 5:02 am
by LeroyTennison
Writer 4.1.13 on Linux but that probably doesn't matter. Trying to insert a (bash) script file into a Writer document but it contains extended ASCII characters which cause Writer to do strange things. I need to be able to copy this file from Writer and paste it into a text-only editor to save it for use. I'm aware that zip files can't be imported. What I ended up doing was using the base64 program to convert the script file to all "printable" characters and importing that into a section using Insert->File. I can then use Ctrl-A in the section, copy and paste into a text-only editor to save as a file. Once done I can then use the -d option to base64 sending the output to a file to convert it back to its original format for use.
Hoping someone knows a more elegant way to do this, any suggestions?
Re: Insert file with "problem" characters in Writer
Posted: Thu Nov 13, 2025 5:46 am
by LeroyTennison
Right after I posted I thought to run the Linux "file" program against the script to see what kind of file it thought it was. When it reported UTF-8 that gave me a thought - try changing the Character Set from the default (Western something) to UTF-8. This helped a lot but not totally. When I copied the inserted content from Writer, pasted it into a text-only editor, saved it as a file and compared the differences to the original file they were minor - some space characters between the last character on a line and the end-of-line were removed along with a couple of other odd spacing differences. As long as you're not using a language which depends on indention for interpreting you're probably safe.
Re: Insert file with "problem" characters in Writer
Posted: Thu Nov 13, 2025 7:58 pm
by JeJe
LibreOffice might or might not do a different UTF-8 import. [Solved] in the subject heading marks this a solved, if you're happy with your own fix.
Re: Insert file with "problem" characters in Writer
Posted: Sat Nov 15, 2025 5:15 am
by MrProgrammer
… insert a … file into Writer … then copy … and paste it into … a text editor to save it
The unknown (to us) goal apparently involves working with a bash script on Linux. You've decided to perform this task using OpenOffice and some undisclosed Linux text editor. But you've run into a secondary content transfer problem with Writer and/or the mysterious text editor, then ask about that here. This seems like
XY problem. You should ask about the
primary goal, not some secondary problem in a step you chose. Do that on a
Linux forum, not here, because this is an OpenOffice forum and OpenOffice may not be a good way to achieve the primary goal. A web search might find the solution or lead you in the right direction.