anchor.diff:              ?ACE_PREFIX ++ punycode:encode(Label)
       end.
   
  -from_ascii([], Acc) ->
  -    lists:reverse(Acc);
  -from_ascii([Label|Labels], []) ->
  -    from_ascii(Labels, lists:reverse(label_from_ascii(Label)));
  -from_ascii([Label|Labels], Acc) ->
  -    from_ascii(Labels, lists:reverse(label_from_ascii(Label), [$.|Acc])).
  -
  -label_from_ascii(?ACE_PREFIX ++ Label) ->
  -    punycode:decode(Label);
  -label_from_ascii(Label) ->
  +decode_1([], Acc) ->
  +    list:reverse(Acc);
  +decode_1([Label|Labels], []) ->
  +    decode_1(Labels, lists:reverse(ulabel(Label)));
  +decode_1([Label|Labels], Acc) ->
  +    decode_1(Labels, lists:reverse(ulabel(Label), [$.|Acc])).
  +
  +ulabel(?ACE_PREFIX ++ Label0) ->
  +    Label = punycode:decode(Label0),
  +    ok = check_label(Label),
  +    Label;
  +ulabel(Label) ->
  +    ok = check_label(Label),
       Label.
   
   
  
positive.code: encode_1([Label|Labels], Acc) ->
      encode_1(Labels, lists:reverse(alabel(Label), [$.|Acc])).
  
  
  check_nfc(Label) ->
    case characters_to_nfc_list(Label) of
      Label -> ok;
  
negative.code:         encode_1(Labels, [])
      end.
  
  decode(Domain) ->
    decode(Domain, []).
  
  decode(Domain0, Options) ->
    ok = validate_options(Options),
    Domain = case proplists:get_value(uts46, Options, false) of
               true ->
                 STD3Rules = proplists:get_value(std3_rules, Options, false),
                 uts46_remap(Domain0, STD3Rules, false);
               false ->
                 Domain0
             end,
    Labels = case proplists:get_value(strict, Options, false) of
               false ->
                 re:split(lowercase(Domain), "[.。．｡]", [{return, list}, unicode]);
               true ->
                  string:tokens(lowercase(Domain), ".")
             end,
  
    case Labels of
        [] -> exit(empty_domain);
        _ ->
          decode_1(Labels, [])
      end.
  
  
  %% Compatibility API
  %%
  
  to_ascii(Domain) -> encode(Domain, [uts46]).
  
  
  