util-src/encodings.c

changeset 2572
0584e157f073
parent 1860
5ef1eea887ca
child 2923
b7049746bd29
equal deleted inserted replaced
2571:8a16c5e92bcb 2572:0584e157f073
172 static int Lidna_to_ascii(lua_State *L) /** idna.to_ascii(s) */ 172 static int Lidna_to_ascii(lua_State *L) /** idna.to_ascii(s) */
173 { 173 {
174 size_t len; 174 size_t len;
175 const char *s = luaL_checklstring(L, 1, &len); 175 const char *s = luaL_checklstring(L, 1, &len);
176 char* output = NULL; 176 char* output = NULL;
177 int ret = idna_to_ascii_8z(s, &output, 0); 177 int ret = idna_to_ascii_8z(s, &output, IDNA_USE_STD3_ASCII_RULES);
178 if (ret == IDNA_SUCCESS) { 178 if (ret == IDNA_SUCCESS) {
179 lua_pushstring(L, output); 179 lua_pushstring(L, output);
180 idn_free(output); 180 idn_free(output);
181 return 1; 181 return 1;
182 } else { 182 } else {

mercurial