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 { |