1

機能について助けが必要file_get_contents()です。

ヘブライ文字を含む URL からデータをフェッチしようとすると、ホストからエラーが発生します (無効なリンク)。

例えば:

file_get_contents('http://domain.com/page/עברית');

私にはうまくいきません。

4

1 に答える 1

0

URL に UTF-8 文字を含めることはできません。最初に URL エンコードする必要があります。お使いのブラウザーでは UTF-8 文字として表示される場合がありますが、それは単にお使いのブラウザーが見栄えを良くするためです。

When a new URI scheme defines a component that represents textual
data consisting of characters from the Universal Character Set [UCS],
the data should first be encoded as octets according to the UTF-8
character encoding [STD63]; then only those octets that do not
correspond to characters in the unreserved set should be percent-
encoded.  For example, the character A would be represented as "A",
the character LATIN CAPITAL LETTER A WITH GRAVE would be represented
as "%C3%80", and the character KATAKANA LETTER A would be represented
as "%E3%82%A2".

https://www.rfc-editor.org/rfc/rfc3986#section-2.5

于 2013-03-17T23:14:44.350 に答える