Xpath with non standard characters {a[@name=”Rozmiar pier?cionków”]} SOLVED!
-
Hi!
When using simple Xpath get value by attribute name
{attrs/a[@name="Rozmiar pier?cionków"]}
it doesnt work because it contains non-standard character ? ó . I couldnt wrap my head around it.After long searching I found https://gist.github.com/trey8611/7b6e79e6610f9d2b06257fb570f05e03 “WP All Import – use XPath Query based on Cyrillic attribute value” from trey8611.
So for example: Rozmiar pier?cionków
Encoded with https://mothereff.in/html-entities
(Enable option “only encode unsafe and non-ASCII characters”)Rozmiar pier?cionków => Rozmiar pierś ;cionkó ;w"
(I added spaces before ; because it would auto decode here even inside code block)!!! PASTING IT IN DESCRIPTION VISUAL TEXT EDITOR BREAKS IT
!!! CHANGE FIRST TO TEXT EDITOR IN WP ALL IMPORTDifferent results:
0 {attrs/a/@name} --- Rozmiar pier?cionków --- Correct test 1 {attrs/a[@name="Rozmiar pier?cionków"]} --- Doesnt work 2 {attrs/a[@name="Rozmiar pierś ;cionkó ;w"]} --- US8 EU17 --- Correct working answer! 3 {attrs/a[@name="Rozmiar pier&sacute ;cionkó ;w"]} --- Doesnt work 4 {attrs/a[@name="R ;o ;z ;m ;i ;a ;r ;  ;p ;i ;e ;r ;ś ;c ;i ;o ;n ;k ;ó ;w"]} --- Doesnt work
(I added spaces before ; because it would auto decode here even inside code block)
Works for cyrillic characters too.
Happy imports ??
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by . Reason: I added spaces before ; because it would auto decode here even inside code block
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- This topic was modified 2 years, 4 months ago by .
- The topic ‘Xpath with non standard characters {a[@name=”Rozmiar pier?cionków”]} SOLVED!’ is closed to new replies.