2013-03-17 1 views
0

file_get_contents() 기능과 관련하여 도움이 필요합니다.히브리 문자열로 file_get_contents 사용

일부 히브리어 문자가 포함 된 URL에서 데이터를 가져 오려고 할 때 호스트 (잘못된 링크)에서 오류가 발생합니다. 예를 들어

:

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

나를 위해 작동하지 않습니다.

+0

오류는 무엇을 말하는가? utf8_encode를 사용해 보셨습니까? – Jonast92

+0

히브리어 문자에서 URL 인코딩이 작동합니까? – ajreal

+0

URL이 브라우저에서 작동하지 않습니다. – MatRt

답변

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". 

http://tools.ietf.org/html/rfc3986#section-2.5

+0

언제든지 RFC에 링크되어 있습니까? – PeeHaa

+0

나는 그것을 추가했다. 희망이 도움이 :) – Evert

+0

@ evert. 감사! – PeeHaa