posting c source code
-
I have an ongoing problem posting C++ source code snippets on my blog.
If i put in
[code lang="cpp"]
blah blah "whatever";
[/code]It will look ok to start but later I will go back to the post and find the quotes replaced with "e; the same sort of thing happens with ampersands, <‘s etc.
I am using the titan theme and an example of a munged post is at http://olduino.wordpress.com/2014/02/25/olduino-web-server-low-level-code/
Another post that also has special characters but hasn’t yet been corrupted is at
http://olduino.wordpress.com/2014/02/25/the-olduino-server-code/Thanks for any help
The blog I need help with is: (visible only to logged in users)
-
You may want to try switching themes as Titan is a retired theme. I don’t know if that will help or not so I tagged this thread for Staff assistance. Please subscribe to it so you are notified when they respond. Note there is a backlog so you will have to wait patiently for Staff help.
To subscribe:
1. Look in the sidebar of this thread and find the subscribe to topics link.
2. Look below the comment box:
_ Notify me of followup posts via e-mail -
Hi there,
You said that it looks ok to start but later the code displays HTML entities instead of the correct characters. Can you describe any steps you take between creating the post and when you notice those HTML entities in there? That will help me track down how exactly this is happening.
-
I think it must be when I modify the post later. I’ll try a specific test and see if I can duplicate it.
-
That’d be great! We’ve made some improvements to the editor to fix some problems like this that were reported to us earlier. If you’re still having trouble with it when you edit a post, knowing the steps that cause the problem will help us investigate and hopefully fix it for you.
-
ok. If I edit an existing post with the “improved experience” editor, the special characters get changed to html equivalents. doesn’t matter if i built the post with new or old editor or if i’m in text or visual, edit the post and bang, it’s corrupted.
I tried a new post in another blog with a different theme. enter it with the original editor and it’s fine
[sourcecode lang="cpp"] "string" [/sourcecode]change to the new editor and it’s corrupted
[sourcecode lang="cpp"] if (a&&b) "string" [/sourcecode]I took screenshots before and after if you want to see them.
I would have said i had seen this in the past but the new editor is certainly the easiest way to cause it.
-
oops, I copied the wrong code for the “after” case. It was
[sourcecode lang="cpp"] if (a&&b) "string" [/sourcecode] -
ahh bizarre – it looks wrong in my blog but it shows ok here!
look at
http://thelongrides.wordpress.com/2014/10/11/test-code-post/
to see the problem -
Thanks so much for these additional details! I was able to reproduce the issue and I’ve asked the developers to take a look. I’ll let you know when I hear back. :)
-
Hi there! I just wanted to let you know that this has been fixed. These characters won’t be encoded when you open the post in the WordPress.com editor anymore.
Let me know if you have any trouble with that!
-
-
I had for sure seen this as recently as last week but I tried it and it seems fine.
Thanks again!
-
- The topic ‘posting c source code’ is closed to new replies.