1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 #include "base/strings/string16.h"
8 #include "base/strings/string_piece.h"
9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "url/url_canon_internal.h"
15 // Only allow ASCII to avoid ICU dependency. Use NSString+IDN
16 // to convert non-ASCII URL prior to passing to API.
17 bool IDNToASCII(const base::char16* src, int src_len, CanonOutputW* output) {
18 if (base::IsStringASCII(base::StringPiece16(src, src_len))) {
19 output->Append(src, src_len);
22 DCHECK(false) << "IDN URL support is not available.";