Convert text files to utf-8

Dolphin Service Menus

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

0
Become a Fan
5.0

Description:
Convert any text file from latin-1 charset to utf-8
by two mouse clicks.

---------------------------------------------------
About
---------------------------------------------------

After upgrading my Linux box to Suse 9.2, I had a
big problem: In many text(-based) files there didn't
show up any non-ascii characters (e.g. umlauts: äöüß
any more. Instead there were ugly boxes or even
nothing at all.

It took me quite some googling until I found the
reason and solution: Suse switched their default
encoding to utf-8, so that files from my old system
as well as some new files I encounter from time to
time being encoded in latin-1 don't show up correctly
any more.

The solution is to convert every single of these files
to utf-8 using the command line tool "iconv", which
is part of the c library and therefore should be
present on any Linux system.

To ease things up, I created this KDE service menu which
allows me to convert files with just two mouse clicks
and even works on multiple selected files. So, every
time I encounter another non-utf-8 file, I can continue
working with a corrected file in only a matter of
seconds :-).

As there seem to be many other users with this kind
of problem out there, I decided to share it to you.
So enjoy and drop me a note (kde@benno-dielmann.de)
, if you like it (or if there are problems...)!

---------------------------------------------------
Installation
---------------------------------------------------

Copy the file

iconv-servicemenu.desktop

to

$KDEDIR/share/apps/konqueror/servicemenus/

and you are done!

---------------------------------------------------
Usage
---------------------------------------------------

Select the file(s) to convert and select "convert to
utf-8" from the actions submenu of the right-mouse-
button menu. A new (converted) file with suffix _utf-8
is created in the same directory. The original file is
left untouched, in case anything went wrong ;-).

Ratings & Comments

2 Comments

testerus

How do you detect the encoding of the textfile before converting for utf-8? Are you using the encoding detection of Konqueror (http://webcvs.kde.org/kdelibs/khtml/misc/) or Mozilla (http://www.mozilla.org/projects/intl/chardet.html)?

bendie

;-) In fact, there is no encoding detection at all. Its just a simple wrapper for the command iconv -f latin-1 -t utf_8 %u -o %u_utf-8 where %u is the selected file. Nothing more. If you have to convert other encodings than latin-1, I suggest you to replace this in the iconv-servicemenu.desktop. If you know of any method to add automatic detection please let me know. The examples you provide all seem to involve programming exceeding the scope of such a simple service menu entry. Correct me if I'm wrong... For me personally, there isn't any need for several different input encodings since I use it mainly for converting my old files from my backups (See the lengthy description above...), on which latin-1 works quite well. If there is anyone out there needing detection of different input encodings, please let me know, so I can think about a way to add it.

Pling
0 Affiliates
Details
license
version 1.0
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 1

Other Dolphin Service Menus:

burnWithGrowisofs
chunkylover
last update date: 20 years ago

Score 5.0

Firefox-bookmarks service menu
storyteller
last update date: 20 years ago

Score 5.0

Text Convert Service Menu
smp-penguin
last update date: 21 years ago

Score 5.0

Pdflatex servicemenu
bobuse
last update date: 20 years ago

Score 5.0

Send through Bluetooth
dmnet
last update date: 21 years ago

Score 5.0

Add to Bloglines
spookster
last update date: 20 years ago

Score 5.0



System Tags