# Can you translate utf8 file to ascii with non-ascii characters replaced by tex-macro?

The title says it all. I have a unicode (utf-8) file which contains some non-ascii characters, e.g. "ö" and translate it into an ascii-file where the non-ascii characters are replaced with tex-macros, in this case `\"o`.

Any ideas? I found this converter but it's only to HTML.

-
Why not use `\usepackage[utf8]{inputenc}` to be able to use utf8 characters? – N.N. Oct 12 '11 at 10:11
I don't want it for latex but for handling my bibtex-database. Many tools do not treat utf-8 correctly – thias Oct 12 '11 at 11:43

## migrated from stackoverflow.comOct 12 '11 at 14:27

you can take a look at utf2any
http://www.ctan.org/pkg/utf2any
not sure if it does what you want

or maybe some other package from one of these lists
http://www.ctan.org/keyword/encodings
http://www.ctan.org/characterization/primary/tools/convert-formats/

generally i would say it is preferrable to use a completly utf8 capable toolchain instead of converting utf8 files to non-utf8

edit: i see you want for utf-8 for you bibliography: there are utf-8 capable tools available for this. instead of bibtex you can use biblatex and biber - switching is easy! i have lots of äöüß and more in my .bib-file and it works just great. as a start you can try something like

``````\usepackage[
backend=biber,
style=authoryear-icomp,
sortlocale=de_DE,
natbib=true,
]{biblatex}
\bibliography{Bibfile}
``````
-
 great references, thanks a lot! – thias Oct 16 '11 at 7:35 I would appreciate to know which solution you have found. I also want a command which would transform ö into \"o... – nicolas roy Feb 22 '12 at 22:41 Note that `\bibliography` is obsolete and replaced by `\addbibresource{Bibfile.bib}` (mandatory suffix) (cf. manual, sec. 3.5.1). – Tobi Apr 18 '12 at 21:55

With `biblatex` and `biber`, you can set the `biblatex` options

``````bibencoding=utf8
texencoding=ascii
``````

And `biber` will reencode your utf8 bib file into TeX macros in the `.bbl`

See the `biber` manual for details and options

-