Split \n issue on PHP

Hello, I have a problem with splitting a table, I enter ean13 codes in a textarea with a line break, so I do a split in order to retrieve the EAN13 codes one by one, but it doesn’t seem be done.

https://intranet.paritys.com/visuelsEAN.php
exemple EAN13 :
9782848319735
8424917798751
8424917756195

Thanks for your help

Hello,

This seems a Wappler bug, I believe you’re doing everything right

I think we can get this moved to the bug report category

Edit: Done, it’s now in the bug report category

I don’t think it’s a bug. I think you need to double escape

.split('\\n')

Otherwise you’re just escaping the n when it gets evaluated

no ^^


.split('\n')

is the correct expression, no need to escape the \. Can you open your server action in code view and check what is the exact split expression added in the code of your server action?

As @teodor suggests, If you open the API file in code view it will have escaped the \ when saved leaving .split('\\n')
remove the extra escape and it works

Becomes


image

1 Like


No sorry, \n it’s test
i replace \n by \n but no ok

it’s a bug between the file and the visualization in wappler


It’s been assigned to @george so they will probably issue a fix soon. Just remove the extra \ in the code view for now and it will work

yes its good


Thanks all