Skip to content
TORNLIFE More

API Bug - returns null when special characters

Started by Jeggy [1526723] on in Bugs & Issues.

20 replies · 264 views · thread synced · 7 days ago · View on torn.com
About this thread

Posts archived: 21 / 21 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
21
Discussion span
→
Authority score
61 / 100
Historical score
45 / 100
Story score
53 / 100
Engagement score
63 / 100

People posting, likes and official posts are not counted for this thread yet: on threads longer than one page they come from a periodic pass over the archive, which has not covered it.

Most-liked replies

Mentioned in this thread

Faction 1149 ×1 Faction 8989 ×1 Faction 9100 ×1

Jeggy [1526723]

When I'm doing a API Call to "https://api.torn.com/faction/?selections=mainnewsfull&key=MyKey" I get null in mainnews.news when the faction name contains special characters, like in this specific news it's this "Ordnance Mafia declared war on Phoenix Rising."


Example response:
...
"181294418": { "timestamp": 1453512649, "news": null },
...

This example contains the real news id, so torn developers can probably look it up there ;)

Update:
I can see that writing the special character in forums doesn't work either :P

So here's a screenshot of it:
[image: jebster.net]
McNeo [864688]

One of my users reported the same thing to me - I'm glad this one isn't my problem :D

Not that this is coming from the personal events of the faction leader - not the faction news - so the same issue appears to be in multiple sections of the api

[image: s32.postimg.org]
Jeggy [1526723]

I'm never getting that? I have tried looking at the raw data within Postman. But a simple if statement fixes it in my code.
Don't wanna remove a nice feature like that from Torn
Chedburn [1] Admin Developer

I believe this is a problem with your scripts (not using UTF-8?).

Everything is working fine on our end. The only solution I can make here is to force faction names to use plain characters only.
Jeggy [1526723]

[image: jebster.net]

Here you can see it in raw data. I really think it is on your end, but if removing the ability to have a faction name like that is the solution, I'd rather have the bug and use a IF statement in my code.

And I don't know what more Info you guys want. This has been marked as "Info Required" and "Confirmed" multiple times [:tongue:]
Marc [24377]

Okay, yes, this is a problem on the Torn api page directly then:

From our Faction news:
  • 30/06/163:03:50 PMJUX HQ declared war on ArmyOfDarkness Recruiting. You are contesting for their rank of #22.
  • 30/06/163:03:41 PMJUX HQ declared war on HT. You are contesting for their rank of #27.
From the API:
"191350978": { "timestamp": 1467299030, "news": "<a class="t-red bold" href = "http://www.torn.com/factions.php?step=profile&ID=8989">JUX HQ</a> declared war on <a class="t-red bold" href = "http://www.torn.com/factions.php?step=profile&ID=9100">ArmyOfDarkness Recruiting</a>. You are contesting for their rank of #22." },
"191350968": { "timestamp": 1467299021, "news": null },

Mentions: JUX HQ [8989] · The Black Hand of Monarch [9100] · WTF [1149]

aurel1 [1046304] Admin Staff

I afraid that for now (as a quick fix) we will need to remove special chars from factions names. Can you please check, how it looks now for you?
Jeggy [1526723]

it works now, but in my code I used split on '<' and '>' and you have changed it into < and > now and my script doesn't work as it should.

If this is a temporary fix or permanent fix, please let me know, so I can change my script accordingly.
Jeggy [1526723]

This is directly from the api.torn.com site:
......
"183278493": {
"timestamp": 1456073390,
"news": "A 7 day NAP has been accepted between <a href=http://www.torn.com/factions.php?step=profile&ID=11522>Phoenix Rising</a> & <a href=http://www.torn.com/factions.php?step=profile&ID=8981>Ordnance Mafia</a>"
},
.....
I can see that you removed the 'Trademark' text, but now it's using < and >
You probably used some escaping function?


And here's an example of how it looks in my script:
[image: jebster.net]
I donated 5 points and it didn't find it in the text as it couldn't find '>'
LouBaker [1162207]

Well im in a pickle with this, there is no way HenkiePuk is going to remove the Ð from Ðestructive Anomaly

I dont mind there being no Ð as i can and have fixed it with an if statement

what can i do
LouBaker [1162207]

this has now got really silly

like this post

{ "mainnews": {

"206984697": { "timestamp": 1487515698, "news": null },

"206984486": { "timestamp": 1487515515, "news": null },

"206984325": { "timestamp": 1487515371, "news": null },

"206982664": { "timestamp": 1487513395, "news": null },

"206982550": { "timestamp": 1487513258, "news": null },

"206982225": { "timestamp": 1487512903, "news": null },

"206981845": { "timestamp": 1487512451, "news": null },

"206981739": { "timestamp": 1487512308, "news": null },

"206981116": { "timestamp": 1487511663, "news": null },

"206980656": { "timestamp": 1487511200, "news": null },

"206979819": { "timestamp": 1487510395, "news": null },

"206979228": { "timestamp": 1487510063, "news": null },

"206977630": { "timestamp": 1487508830, "news": null },

"206977143": { "timestamp": 1487508369, "news": null },

"206977005": { "timestamp": 1487508223, "news": null },

"206976133": { "timestamp": 1487507355, "news": null },

"206971722": { "timestamp": 1487501328, "news": null },

"206971495": { "timestamp": 1487501014, "news": null },

"206971383": { "timestamp": 1487500856, "news": null },

"206967553": { "timestamp": 1487495867, "news": null },

"206967367": { "timestamp": 1487495623, "news": null },

"206966497": { "timestamp": 1487494539, "news": null },

"206966358": { "timestamp": 1487494292, "news": null },

"206966108": { "timestamp": 1487493875, "news": null },

"206965830": { "timestamp": 1487493527, "news": null },

"206965791": { "timestamp": 1487493469, "news": null },

"206965659": { "timestamp": 1487493314, "news": null },

"206961902": { "timestamp": 1487488560, "news": null },

"206961609": { "timestamp": 1487488194, "news": "Co-leadership was transferred to NZSAS." },

"206961552": { "timestamp": 1487488098, "news": null },

"206960528": { "timestamp": 1487486374, "news": null },

"206960366": { "timestamp": 1487486050, "news": null },

"206960023": { "timestamp": 1487485682, "news": null },

"206959736": { "timestamp": 1487485324, "news": null },

"206955247": { "timestamp": 1487479885, "news": null },

"206955216": { "timestamp": 1487479853, "news": null },

"206944386": { "timestamp": 1487467352, "news": null },

"206944377": { "timestamp": 1487467341, "news": null },

"206940743": { "timestamp": 1487464066, "news": "Co-leadership was transferred to KPCSlor." },

"206937349": { "timestamp": 1487460940, "news": null },

"206937305": { "timestamp": 1487460869, "news": null },

"206936913": { "timestamp": 1487460396, "news": null },

"206936893": { "timestamp": 1487460374, "news": null },

"206936846": { "timestamp": 1487460360, "news": null },

"206936707": { "timestamp": 1487460242, "news": null },

"206936674": { "timestamp": 1487460220, "news": "Your faction can now Claim Victory over MMCP" },

"206929653": { "timestamp": 1487453133, "news": null },

"206929633": { "timestamp": 1487453116, "news": null },

"206929605": { "timestamp": 1487453073, "news": null },

"206929549": { "timestamp": 1487453026, "news": null },



this goes on and on, all blank



Cant you sort something out for this