# elementor/3.6.8/core/utils/str.php

Elementor Website Builder – more than just a page builder, version 3.6.8. 24 lines.

- Page: https://pluginprobe.com/plugins/elementor/3.6.8/code/core/utils/str.php
- Raw: https://pluginprobe.com/plugins/elementor/3.6.8/raw/core/utils/str.php
- Modified: 2021-08-17T10:22:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elementor/3.6.8/code/core/utils/str.php#L10-L20`.

```php
<?php
namespace Elementor\Core\Utils;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class Str {

	/**
	 * Convert a non-latin URL to an IDN one.
	 * Note: Max length is 64 chars.
	 *
	 * @param string $url - A URL to encode.
	 *
	 * @return string - IDN encoded URL ( e.g. `http://é.com` will be encoded to `http://xn--9ca.com` ).
	 */
	public static function encode_idn_url( $url ) {
		return preg_replace_callback( '/(https?:\/\/)(.+)/', function ( $matches ) {
			return $matches[1] . \Requests_IDNAEncoder::encode( $matches[2] );
		}, $url );
	}
}

```
