question

Upvotes
Accepted
1 1 3 4

How to remove formatting characters amid text body of news when retrieving real time news data using MRN_STORY

Hi, one customer called me to ask the question. How to remove those invisible formatting characters amid those printable text words? Because sometimes the re-organized news story body looks like mess because of those special formatting characters. How to typeset those news body text words in order?

refinitiv-realtimeelektronelektron-sdkema-apirrtelektron-message-apimrn
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
19.1k 86 39 63

Hi @Liheng.Wang,

Can you elaborate what you mean by "invisible formatting characters"? The story body text can be determined by the mimeType defined within the JSON data structure - plain text.

Stories do contain <CR><LF> (Carriage Return/Line feeds) which is used for display terminals. In addition, stories can be nativly represented in other language variants. Can you also elaborate what "typeset those news body text words in order"? You mean you want to filter out certain ASCII characters like <CR> <TAB> <LF>, etc? If so, you will need to parse the body of the text and apply your own filtering.


ahs.png (31.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@nick.zincone.1, thank you so much for answer. Yes, that is what I exactly mean. The customer said those ASCII characters are not good enough to phrase the news body and sometimes it will make the news looking like a mess. So they want to remove all this characters and then re-construct them by its own based on the plain text. So the answer is, how to identify all these characters and filter out all of them? I believe the problem they have is about how to make the news body a purely plain text.

Hello @Liheng.Wang
Those control characters are generated from MRN data feed, not from the API or TREP. They are part of news story content and the API just sends it to the client application "as is". If the client wants to remove those ascii characters, the client needs to implement their own filter to detect and remove them in the application level.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.