• Page:
  • 1

Special Characters Removal in CSV file

OFFLINE

Special Characters Removal in CSV file

2 months, 2 weeks ago
In Primefocus, while exporting users which is a csv file.There are special characters seen in column
(for eg:- Arijit Sarkar, Nischit P)

To solve this issue, i have used below code which replaces special characters with blank.

$l1_manager=preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', uKnowvaFactory::getUser($other_info[$res->user_id]->reports_to)->name);


Now issue is resolved.Now in csv column it is showing perfectly i.e Arijit Sarkar, Nischit P

Please check and let me know if there is any suggestions.
Last Edit: 2 months, 2 weeks ago by Sagar S Vemul.
The following user(s) said Thank You: Vicky Jain, Adarsh Surania, Rajat Pal, Aadarsh Jain
OFFLINE

Re: Special Characters Removal in CSV file

2 months, 2 weeks ago
Hi Sagar,

Nice find. But for getting the L1 Manager or Immediate Manager you should always use the case below function -

ConvHelper::getImmediateSuperiors()


Above function will give you the ids of all the L1 Manager or Immediate Managers. Than you loop them and extract the name.

Below code which you are using will not work in case any user have more than 1 L1 Manager or Immediate Manager.

uKnowvaFactory::getUser($other_info[$res->user_id]->reports_to)->name


Also, you should always replace single quotation from null if its a string. By default reports_to stores the string only. So the code should be like below -

uKnowvaFactory::getUser(str_replace("'","",$other_info[$res->user_id]->reports_to))->name


But still ConvHelper::getImmediateSuperiors() is the best practice.

Thanks
The following user(s) said Thank You: Vicky Jain, Sagar S Vemul, Aadarsh Jain
OFFLINE

Re: Special Characters Removal in CSV file

2 months, 2 weeks ago
Thanks for your helpful information, but this uKnowvaFactory::getUser($other_info[$res->user_id]->reports_to)->name has already there in site.

Only removed Special characters from that function using above code

Once again thanks..
  • Page:
  • 1

Upcoming Events

Who's Online

2 users online