[Solved] Insert file with "problem" characters in Writer

Discuss the word processor
Locked
LeroyTennison
Posts: 131
Joined: Sun Dec 20, 2009 8:12 am

[Solved] Insert file with "problem" characters in Writer

Post 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?
Last edited by MrProgrammer on Sat Nov 22, 2025 10:59 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] for solution from LeroyTennison
Apache OpenOffice 4.1.2 on Linux (Ubuntu 14.04 LTS)
LeroyTennison
Posts: 131
Joined: Sun Dec 20, 2009 8:12 am

Re: Insert file with "problem" characters in Writer

Post 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.
Apache OpenOffice 4.1.2 on Linux (Ubuntu 14.04 LTS)
JeJe
Volunteer
Posts: 3132
Joined: Wed Mar 09, 2016 2:40 pm

Re: Insert file with "problem" characters in Writer

Post 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.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
MrProgrammer
Moderator
Posts: 5432
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Insert file with "problem" characters in Writer

Post 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.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Locked