utf8.translate
Available inall subroutines.
Translates from one set of characters (Unicode code points) to another.
Characters of set1 in the input string are replaced with characters of set2,
where the first character of set1 is translated to the first character of
set2, and so on. If there are more characters in set1 than in set2, the
last character of set2 is used to replace all excess characters of set1.
Characters in the input string not contained in set1 are passed through
unchanged.
Errors
This function requires the input string input to be UTF-8 encoded. If it is
not, fastly.error will be set to EUTF8.
Example
1234567891011declare local var.in STRING = "Hello, world!";declare local var.out STRING;
# ROT13set var.out = utf8.translate(var.in, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm");# var.out is "Uryyb, jbeyq!"
# Remove a set of accents from req.urlset req.url = utf8.translate(req.url, "áäåéëíïóöøúü", "aaaeeiiooouu");