0

I am trying to generate CSV file with javascript.

Everything is superb with the file, but since the data I am exporting in the CSV may contain arabic characters some of the rows appear as if they have \n(new line)

This is my input data:

حاجى مالك نورزى (Hajji Malik Noorzai; Hajji Malak Noorzai; Haji Malek Noorzai);Haji Maluk;Haji Aminullah;Allah Muhammad

This is the output in the CSV file, here is not visiable :

MALIK NOORZAI;
                    Haji Malek Noorzai);Allah Muhammad;Haji Aminullah;Haji Maluk;Hajji Malak Noorzai;حاجى مالك نورزى (Hajji Malik Noorzai

Can anybody help me how to sort this out?

I have idea to check if my string contains arabic characters with regex, and then wrap it with something like the answers in this thread: Concat RTL string with LTR string in javascript

I have tried with this regex:

/[\u0600-\u06FF]/g

which in my opinion leaves the first character حاجى مالك نورزى unmatched(by first I mean the leftest)

Community
  • 1
  • 1
Evgeni Atanasov
  • 482
  • 1
  • 5
  • 13

1 Answers1

0

Ok, I fixed this problem. The string contains \r\n which seemed like space character and were very hard to identify.

Evgeni Atanasov
  • 482
  • 1
  • 5
  • 13