Sublime Forum

Auto replace snippet for umlauts. Can´t us UTF-8

#1

Hi Guys,

I´m trying to write or find a snippet which has the ability to replace all german umlauts by once (Ü,Ö,Ä,ö,ü,ä,ß,€, etc…)
I know that if I use UTF-8 I don´t need that, but im write E-Mail Newsletter for costumers who are still using Outlook 03 -07. and to change the umlauts manually every time, that sucks.

So please could you help me :smiley:

Cheers

Tobi

0 Likes

#2

You mean you want to autp-replace Umlauts with their ASCII equivalent? Always or only in certain files (with a certain syntax)?

0 Likes

#3

Hi FichteFoll,

yeah Im searchin for a snippet that I can use always. and just for html (german to ASCII)

Thanks :slightly_smiling:

Tobi

0 Likes

#4

You want to replace ü with ue, Ü with Ue, ß with ss, … over the whole file?

0 Likes

#5

Ü -> & Uuml;
ü -> & uuml;
Ö -> & Ouml;
ö -> & ouml;
ß -> & szlig;

german umlauts to ASCII

replace them through a key combination like cmd+b

0 Likes

#6

The package StringEncode adds commands to convert characters to html entities. Just select the character and run the command StringEncode: HTML Entitize.
You can also add a keybinding

    {
        "keys": ["ctrl+alt+b"],
        "command": "html_entitize",
        "context":
        [
            { "key": "selector", "operator": "equal", "operand": "text.html" }
        ]
    },

If you want to replace all non-ascii word characters just search (ctrl+f) for (?=[^\x00-\x7F])\w with regex enabled (alt+r) and select all (alt+enter), then press they keybinding (e.g. ctrl+alt+b).

0 Likes

#7

Note that these are not the traditional “ASCII equivalents”, which would be Ü -> Ue and ö -> oe. What you mean are HTML entities, which @r-stein has covered above.

Other than that, you could create key bindings like this:

    { "keys": ["ö"], "command": "insert", "args": {"characters": "ö"} }
0 Likes