• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <string.h>
6
7#include <ostream>
8#include <string>
9#include <string_view>
10
11#include "base/strings/string_util.h"
12#include "base/strings/utf_string_conversions.h"
13#include "url/url_canon_internal.h"
14
15namespace url {
16
17// Only allow ASCII to avoid ICU dependency. Use NSString+IDN
18// to convert non-ASCII URL prior to passing to API.
19bool IDNToASCII(std::u16string_view src, CanonOutputW* output) {
20  if (base::IsStringASCII(src)) {
21    output->Append(src);
22    return true;
23  }
24  DCHECK(false) << "IDN URL support is not available.";
25  return false;
26}
27
28}  // namespace url
29