Asset Manager should document how to handle newline characters in Rest POST/PUT

Idea ID 2774540

Asset Manager should document how to handle newline characters in Rest POST/PUT

Past and current version (9.71) of Asset Manager fails at documenting that newline characters (\r and \n) within memComment and long text fields during insert and update (POST and PUT respectively.)

In order to successfully write multiline text, newline character sequences have to be "escaped" in an unconventional (and formidably ugly) manner.

While at it, documentation should also include a short paragraph about how single quotes characters also need to be escaped.

For reference, below is the javascript  snippet we currently use to handle text values to POST/PUT

 

 

value
  .replace(/'/g, "''") // escape single quotes
  .replace(/\r\n?/g, '\n') // normalize newline character sequences
  .replace(/\n/g, "'+CHAR(13)+CHAR(10)+'"); // escape newline chararacters

 

 

 

1 Comment
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor
Status changed to: Waiting for Votes
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.