Comparison

util-src/encodings.c @ 10262:b1209bc15cd1

util.encodings: Spell out all IDNA 2008 options ICU has
author Kim Alvefur <zash@zash.se>
date Wed, 11 Sep 2019 00:40:30 +0200
parent 10261:010c67532ed0
child 10357:72e6d0d7ff9b
comparison
equal deleted inserted replaced
10261:010c67532ed0 10262:b1209bc15cd1
339 icu_nodeprep = usprep_openByType(USPREP_RFC3920_NODEPREP, &err); 339 icu_nodeprep = usprep_openByType(USPREP_RFC3920_NODEPREP, &err);
340 icu_resourceprep = usprep_openByType(USPREP_RFC3920_RESOURCEPREP, &err); 340 icu_resourceprep = usprep_openByType(USPREP_RFC3920_RESOURCEPREP, &err);
341 icu_saslprep = usprep_openByType(USPREP_RFC4013_SASLPREP, &err); 341 icu_saslprep = usprep_openByType(USPREP_RFC4013_SASLPREP, &err);
342 icu_spoofcheck = uspoof_open(&err); 342 icu_spoofcheck = uspoof_open(&err);
343 uspoof_setChecks(icu_spoofcheck, USPOOF_CONFUSABLE, &err); 343 uspoof_setChecks(icu_spoofcheck, USPOOF_CONFUSABLE, &err);
344 icu_idna2008 = uidna_openUTS46(UIDNA_USE_STD3_RULES, &err); 344 int options = UIDNA_DEFAULT;
345 #if 0
346 /* COMPAT with future Unicode versions */
347 options |= UIDNA_ALLOW_UNASSIGNED;
348 #endif
349 #if 1
350 /* Forbid eg labels starting with _ */
351 options |= UIDNA_USE_STD3_RULES;
352 #endif
353 #if 0
354 /* TODO determine if we need this */
355 options |= UIDNA_CHECK_BIDI;
356 #endif
357 #if 0
358 /* UTS46 makes it sound like these are the responsibility of registrars */
359 options |= UIDNA_CHECK_CONTEXTJ;
360 options |= UIDNA_CHECK_CONTEXTO;
361 #endif
362 #if 0
363 /* This disables COMPAT with IDNA 2003 */
364 options |= UIDNA_NONTRANSITIONAL_TO_ASCII;
365 options |= UIDNA_NONTRANSITIONAL_TO_UNICODE;
366 #endif
367 icu_idna2008 = uidna_openUTS46(options, &err);
345 368
346 if(U_FAILURE(err)) { 369 if(U_FAILURE(err)) {
347 fprintf(stderr, "[c] util.encodings: error: %s\n", u_errorName((UErrorCode)err)); 370 fprintf(stderr, "[c] util.encodings: error: %s\n", u_errorName((UErrorCode)err));
348 } 371 }
349 } 372 }