LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Removing accented characters

    Employee
    Posted 11-21-2017 08:13

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: islandz

    I am trying to remove accented characters and replace them with their corresponding non-accented character. I am trying the following:

    <field>.str()..regexSubstitute("����","e").regexSu bstitute("������","A").regexSubstitute("�","C").re gexSubstitute("�","D").regexSubstitute("����","E") .regexSubstitute("�","F").regexSubstitute("����"," I").regexSubstitute("�","N").regexSubstitute("���� ��","O").regexSubstitute("�","S").regexSubstitute( "����","U").regexSubstitute("��","Y").regexSubstit ute("�","Z").regexSubstitute("������","a").regexSu bstitute("�","c").regexSubstitute("�","f").regexSu bstitute("����","i").regexSubstitute("�","n").rege xSubstitute("������","o").regexSubstitute("�","s") .regexSubstitute("����","u").regexSubstitute("��", "y").regexSubstitute("�","z")

    First, it seems I have to add the str() at the start of the substitution list, or else I get a UTF-8 character error. (Not sure why.) But, this substitution does not need to work in all instances. I do see some situations in which the characters are correctly replaced (� is replaced with C) but other instances where they are not (� remains, and is not replaced with e).

    Can anyone see/advise what I am doing wrong?

    Thank you in advance


  • 2.  RE: Removing accented characters

    Employee
    Posted 11-22-2017 03:56

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Your replacement of "�" with "C" works because this "�" is the only character in the pattern for that particular regexSubstitute() operator.

    In the case of the substitution of "����" for "e" this is failing to match because your pattern is specifies that the entire four character string "����" needs to be present for the match. If you want to match any of the characters then you need to change the pattern to insert an 'or' between each accented character "�|�|�|�"

    Can you provide an example of the data that is causing the UTF-8 error - e.g. by opening the data viewer selecting all or the selected rows/columns then use 'Edit' -> 'Copy as Static Data' and paste the data into your reply to the post.

    You previously asked a similar question back in April. Was there an issue with using the solutions provided to that post? If you require additional character substitutions you can modify the '_Acc_Chars' and '_Reg_Chars' strings as described in the reply.

    http://community.lavastorm.com/threa...0466#post10466