'Convert accent characters to normal characters in Liquid
For instance name = Florian Müllner, want name to be Florian MUllner
How to covert name with accented characters in Liquid?
Read the replace doc, but was not able to figure out. How to use?
Solution 1:[1]
You can use replace like this.
{% assign text = 'Florian Müllner' | replace: "ü", "U" %}
Solution 2:[2]
This is my very very dirty solution and far from complete (but works for my needs) with no plugins in Jekyll:
{% assign text = 'Müller Pérez' %}
{% include normalize_text.html %}
and the included file works as a function:
{% assign text = text | replace: 'á', 'a' | replace: 'é', 'e' | replace: 'í', 'i' | replace: 'ó', 'o' | replace: 'ú', 'u' %}
{% assign text = text | replace: 'à', 'a' | replace: 'è, 'e' | replace: 'ì', 'i' | replace: 'ò', 'o' | replace: 'ù', 'u' %}
{% assign text = text | replace: 'ä', 'a' | replace: 'ë', 'e' | replace: 'ï', 'i' | replace: 'ö', 'o' | replace: 'ü', 'u' %}
{% assign text = text | replace: 'â', 'a' | replace: 'ê, 'e' | replace: 'î', 'i' | replace: 'ô', 'o' | replace: 'û', 'u' %}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DVS |
| Solution 2 | kinsay |
