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.  Diagnosing special characters

    Employee
    Posted 04-28-2015 07:23

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

    Originally posted by: jmorrissette

    I am having an issue with posting certain strings to SalesForce.com. It seems to choke on certain special characters. In particular, some kinds of end of line events work and some don't. Unfortunately I cannot tell which EOL characters are being used to correct. If I know the ASCII code I should be able substitute for a non offensive string. So I suppose this is not really a SalesForce question per se because the ability to diagnose special characters has broader use I would imagine as many APIs would have this issue. So my thought is to split the string into separate characters and then get the ascii code for each character, but I'm not sure how to do that. Thoughts?


  • 2.  RE: Diagnosing special characters

    Employee
    Posted 04-28-2015 07:33

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

    Originally posted by: jmorrissette

    By the way, I already know how to use string find and chr to look for specific characters. In this case I have pretty much already figured out the issue using chr(10) and chr(13), but the larger procedural question remains, how can I break strings down to find offending special characters?


  • 3.  RE: Diagnosing special characters

    Employee
    Posted 04-28-2015 07:38

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

    Originally posted by: asohail

    you can try to do a regex substitute to get rid of special characters like so
    Data_alphaNumsOnly =Data.regexSubstitute("[^A-Za-z0-9 ]",””)

    For example, this expression will get rid of any character thats not A-Z, a-z, 0-9, or space but you can craft a regexpression to be as specific as needed


  • 4.  RE: Diagnosing special characters

    Employee
    Posted 04-28-2015 08:39

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

    Originally posted by: jmorrissette

    That would work to blindly strip characters but I'm looking for a more intelligent diagnosis as oppose to just cleaning out formatting. In essence you want to do something like: Try inserting into API -> when you find an error test inserting character by character -> When you find the problem character replace it and report on it. There should be some way to iterate through characters in a string within LAE I would think.


  • 5.  RE: Diagnosing special characters

    Employee
    Posted 04-28-2015 15:32

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

    Originally posted by: stonysmith

    Use this to convert the string to Hex:

    node:HexFormat
    bretype:core::Filter
    editor:Label=HexFormat
    editor:sortkey=543723537e423ac0
    input:@40fd2c74167f1ca2/=Static_Data_2.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:FieldName=Color
    prop:Script=<<EOX
    ac=""
    i=0
    while i < strlen('{{^FieldName^}}') {
      c=substr('{{^FieldName^}}',i,1)
      ac=ac+format("%02x",ascii(c))
    i=i+1
    }
    emit *
    emit str(ac) as "{{^FieldName^}}_Hex"
    
    EOX
    editor:XY=840,160
    editor:propdef=FieldName|string|BRAINScript||None
    end:HexFormat