Closed vvit closed 4 years ago
ok, I think I can use &
instead.
Too bad I cannot do this via the style.textTransforms = [.custom()]
Thank you for your report. I've added the escapeString
option to the XMLParsingOptions
of the StyleXML
object. By default it's enabled and replaces all encountered special characters not parsable by the internal NSXMLParser
with the escaped string which avoid breaking the style.
I'll release it with the next update.
We are facing the same issue...Our app is live and texts are very sensitive. So we hope we will get a response soon. Thanks in advance...
Getting the following error:
Failed to generate attributed string from xml: XMLStringBuilderError(parserError: Error Domain=NSXMLParserErrorDomain Code=111 \"(null)\", line: 1, column: 152)
The string that is failing and causing the error is the string below no3
This is the string:
\u0623\u064e\u0645\u0652 \u064a\u064e\u0642\u064f\u0648\u0644\u064f\u0648\u0646\u064e <tajweed class=\"ham_wasl\" data-type=\"hamza-wasl\" data-description=\"Hamzat ul Wasl\" data-tajweed=\":6061\">\u0671<\/tajweed>\u0641\u0652\u062a\u064e\u0631\u064e\">\u066e\u0670<\/tajweed>\u0647\u064f\u200c\u06da \u0628\u064e\u0644\u0652 \u0647\u064f\u0648\u064e <tajweed class=\"ham_wasl\" data-type=\"hamza-wasl\" data-description=\"Hamzat ul Wasl\" data-tajweed=\":8923\">\u0671<\/tajweed>\u0644\u0652\u062d\u064e\u0642\u0651\u064f \u0645<tajweed class=\"idgh_w_ghn\" data-type=\"idgham-without-ghunnah\" data-description=\"Idgham - Without Ghunnah\" data-tajweed=\":770\">\u0650\u0646 \u0631<\/tajweed>\u0651\u064e\u0628\u0651\u0650\u0643\u064e \u0644\u0650\u062a\u064f<tajweed class=\"ikhf\" data-type=\"ikhafa\" data-description=\"Ikhafa'\" data-tajweed=\":4582\">\u0646\u0630<\/tajweed>\u0650\u0631\u064e \u0642\u064e\u0648\u0652<tajweed class=\"idgh_ghn\" data-type=\"idgham-with-ghunnah\" data-description=\"Idgham - With Ghunnah\" data-tajweed=\":10181\">\u0645\u064b\u0627 \u0645<\/tajweed>\u0651<tajweed class=\"madda_pbligatory\" data-type=\"madda-obligatory\" data-description=\"Obligatory Prolongation: 4-5 Vowels\" data-tajweed=\"\">\u064e\u0627\u0653<\/tajweed> \u0623\u064e\u062a\u064e<tajweed class=\"madda_normal\" data-type=\"madda-normal\" data-description=\"Normal Prolongation: 2 Vowels\" data-tajweed=\"\">\u0640\u0670<\/tajweed>\u0647<tajweed class=\"idghm_shfw\" data-type=\"idgham-shafawi\" data-description=\"Idgham Shafawi - With Meem\" data-tajweed=\":10182\">\u064f\u0645 \u0645<\/tajweed>\u0651<tajweed class=\"idgh_ghn\" data-type=\"idgham-with-ghunnah\" data-description=\"Idgham - With Ghunnah\" data-tajweed=\":10183\">\u0650\u0646 \u0646<\/tajweed>\u0651\u064e\u0630\u0650\u064a<tajweed class=\"idgh_ghn\" data-type=\"idgham-with-ghunnah\" data-description=\"Idgham - With Ghunnah\" data-tajweed=\":10184\">\u0631\u064d \u0645<\/tajweed>\u0651\u0650<tajweed class=\"ikhf\" data-type=\"ikhafa\" data-description=\"Ikhafa'\" data-tajweed=\":18\">\u0646 \u0642<\/tajweed>\u064e<tajweed class=\"qlq\" data-type=\"qalaqah\" data-description=\"Qalaqah\" data-tajweed=\":19\">\u0628\u0652<\/tajweed>\u0644\u0650\u0643\u064e \u0644\u064e\u0639\u064e\u0644\u0651\u064e\u0647\u064f\u0645\u0652 \u064a\u064e\u0647\u0652\u062a\u064e\u062f<tajweed class=\"madda_permissible\" data-type=\"madda-permissible\" data-description=\"Permissible Prolongation: 2, 4, 6 Vowels\" data-tajweed=\"\">\u064f\u0648<\/tajweed>\u0646\u064e\n
The output we are getting:
Hi there. Thanks for the amazing library. I have a problem with & character in my strings. Not sure if it was discussed already.
When I use
"Lorem ipsum".set(style: "name")
But once I include &
"Lorem & ipsum".set(style: "name")
Maybe I'm missing something? How to show the
&
character? Please advice. Thanks!UPD: I think this is the corresponding output: