Replace weird characters

Comments

3 comments

  • Avatar
    Adrian Williams

    The Python scripting language used by the Transform node is Python 2. You need to declare the strings in your replace() function as unicode rather than as str objects. e.g. using:

    out1.junk = fields.junk.replace(u'ä', u'ä')

    Note also the input field reference in the above statement is 'fields' instead of 'field'

    There is a useful description of some of the issues that can occur when encoding characters here:

    https://www.i18nqa.com/debug/utf8-debug.html 

     

    Also, see the attached example data flow (requires Data3Sixty v.3.2.7 or above)

     

    Regards,

    Adrian

     

    Attached files

    Replace_Weird_Characters_Example - 2 Apr 2019.lna

     

    0
    Comment actions Permalink
  • Avatar
    Adrian Williams

    You could also use the Calculate Fields node instead of the Transform node. The downside is that you need to create separate intermediate fields for each text replacement performed.

    You can use the Modify Fields node to remove the extraneous fields:

    Regards,

    Adrian

     

    0
    Comment actions Permalink
  • Avatar
    annunziato lo bosco

    Hello Adrian,

    thanks a lot, all the solutions wok fine.

    Regards, Annunziato.

    0
    Comment actions Permalink

Please sign in to leave a comment.



Powered by Zendesk