web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to replace or remove any invalid characters from text

(0) ShareShare
ReportReport
Posted on by 56

Hi All,

Kindly let me know how to replace or remove any invalid characters from text in AX 2012 R3. 

When I am copied and trying to paste the invalid characters in code  it display like empty So, not able to apply in function like strRep or strRem to remove or replace that invalid characters from text.

Kindly suggest me how we can achieve this?l

Please give me more shed on this.

thanks!

I have the same question (0)
  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    If I m not wrong you have that character at table so you can get char from the record value with position and use char value for ax str functions (strRep,Rem etc.)

    Or you can search ascii value of the char at internet and use it in the code 

  • @rp@n Profile Picture
    56 on at

    hi Ergun,

    Pls let me know how will get the ASCII characters ? in google unable to paste the invalid character.

    8105.Z1.jpg

    pls send me the sample code.

    thanks

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    Select the record  and set to a string valuable. Get lenght with strlen. Loop it and get every value with char2num. You can get ascii with this. Seach İnternet with this value and do whatever you want at next step

  • @rp@n Profile Picture
    56 on at

    thanks ergun,

    if possible , pls send me the code sample.

  • Martin Dráb Profile Picture
    239,035 Most Valuable Professional on at

    Which characters do you consider invalid in your particular case?

  • @rp@n Profile Picture
    56 on at

    Martin, already I have marked in the screen shot in trail post. Kindly follow pls

  • Martin Dráb Profile Picture
    239,035 Most Valuable Professional on at

    Your screenshot shows two characters. Are you saying that you want a solution for these two characters only? I doubt so. Also, there may be some special characters that aren't actually displayed.

    I believe you need something more generic, but you haven't yet thought about your requirements. You must think about what you actually want before you can write code doing such a thing.

    You mentioned ASCII, therefore you may want to remove all characters that aren't in the ASCII table, but it's not clear whether it's safe enough. There may be non-ASCII characters that may be acceptable. Also, ASCII contains characters that aren't valid for an invoice number, such as the vertical tab. Therefore accepting all ASCII table isn't really safe, although it may be acceptable in your code. Maybe you rather want to accept selected Unicode character categories, or something like that.

  • @rp@n Profile Picture
    56 on at

    Martin, which I marked that only cause the issue. That marked character I wants to remove.

    Kindly advice

  • Suggested answer
    Martin Dráb Profile Picture
    239,035 Most Valuable Professional on at

    Well, that you have the problem with these particular characters today doesn't mean that you won't run to another character tomorrow. Even the title of this thread asks "how to replace or remove any invalid characters".

    But anyway, you can use strReplace() to find and replace a character in a string. If you want to remove it, replace it with an empty string.

  • @rp@n Profile Picture
    56 on at

    Martin, please let me know how will pass that marked character in StrReplace function?

    When i am trying to paster , its showing blank.

    Please give me more shed on this

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 465 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans