2015-01-21 2 views
1

unescape은 더 이상 사용되지 않으며 decodeURIComponent을 선택했지만 예상대로 작동하지 않습니다. decodeURIComponent 캔트 디코드 다음 URI 성분 상기 문자열 decodeURIComponent를 디코딩하는 단계를 차단 나머지 스크립트 실행 오류를 발생하면서decodeURIComponent에서 'URI malformed'오류가 발생했습니다.

Coast%20Guard%20Academy%20to%20hold%20annual%20Women%92s%20%91Leadhership%92%20event 

.

해결 방법이 있습니까?

+0

오류 – roryok

+0

@roryok을 게시하시기 바랍니다 내가 URIError의'무엇입니까 – Quentin

+0

"URI 형식이 잘못"URI malformed'는 콘솔이 시도'decodeURIComponent ('해안 % 20Guard % 20Academy % 20 ° % 20hold % 20annual % 20Women % 92S % 20 % 91Leadhership % 92 % 20event ')' – vimal1083

답변

2

%91%92 문자는 ANSI 코드 페이지를 사용하여 인코딩되었습니다. decodeURIComponent()expects the string to have been encoded as UTF-8는 :

The decodeURIComponent function computes a new version of a URI in which each escape sequence and UTF-8 encoding of the sort that might be introduced by the encodeURIComponent function is replaced with the character that it represents.

두 따옴표 %E2%80%98%E2%80%99로 인코딩해야합니다. -

+0

'+ 1' 나는 잘못된 표준을보고있다. 나는 URI 인코딩 정보를 찾고 있었고, 물론'decodeURIComponent'를 조사 했어야했습니다. –