0

I'm trying to extract links from website that uses cyrillic characters.

Link example:

<a href="/catalog/?filter=Ножницы"><span>Ножницы</span></a>

I use encodeURI function to encode URL and get this result

encodeURI("/catalog/?filter=Ножницы");

"/catalog/?filter=%D0%9D%D0%BE%D0%B6%D0%BD%D0%B8%D1%86%D1%8B"

When I visit this URL, web browser doesn't display any results.

But Google Chrome encode the same link as

catalog/?filter=%CD%EE%E6%ED%E8%F6%FB

And this link does work. How can I in JavaScript encode cyrillic links the same way that Google Chrome does?

Vladislav
  • 483
  • 2
  • 6
  • 17

1 Answers1

0

You have this problem because function encodeURI() work with UTF-8 but you have Win-1251. Start from this question How to convert utf-8 string to urlencoded win1251 in javascript

Community
  • 1
  • 1
Pavel Komiagin
  • 708
  • 6
  • 10