Title: Code Escaping Problem &#8211; Only with one post so far.
Last modified: November 19, 2020

---

# Code Escaping Problem – Only with one post so far.

 *  Resolved [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/)
 * Prismatic Version 2.6
 * This Swift code is causing problems for some reason. It isn’t happening with 
   any of my other pages as far as I can tell.
 * The problem is on the following page:
    [https://ingax.com/decoding-a-secret-message/](https://ingax.com/decoding-a-secret-message/)
 * Examples of pages that work fine:
    [https://ingax.com/reorder-data-in-log-files/](https://ingax.com/reorder-data-in-log-files/)
   [https://ingax.com/separate-string-into-components/](https://ingax.com/separate-string-into-components/)
   [https://ingax.com/valid-palindrome-ii/](https://ingax.com/valid-palindrome-ii/)
   [https://ingax.com/swift-string-index-extension-for-interviews/](https://ingax.com/swift-string-index-extension-for-interviews/)
   [https://ingax.com/reverse-a-linked-list/](https://ingax.com/reverse-a-linked-list/)
   [https://ingax.com/return-the-nth-fibonacci-number-iterative/](https://ingax.com/return-the-nth-fibonacci-number-iterative/)
 *     ```
       import Foundation
   
       func decrypt(word: String) -> String {
           var ascii = word.map { Int($0.asciiValue!) }
   
           let count = ascii.count
   
           var prev = ascii[0]
           for i in 1..<count {
               let temp = ascii[i]
               ascii[i] = ascii[i] - prev
               prev = temp
           }
   
           ascii[0] -= 1
   
           for i in 0..<count {
               while ascii[i] < 96 {
                   ascii[i] += 26
               }
           }
   
           return String(ascii.map {
               Character(UnicodeScalar(UInt8($0)))
           })
       }
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcode-escaping-problem-only-with-one-post-so-far%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13681452)
 * I’m not sure but it looks like an issue with how the code is included in the 
   post content. Are you using the Block Editor or Classic Editor?
 *  Thread Starter [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684529)
 * First of all, thanks for making this plug-in! It’s super useful. 🙂
 * I’m using the Gutenberg Editor on all my posts. And I’m using the Block Editor.
 * I just updated to the latest version of WordPress. Still getting the problem.
 * Troubleshooting:
       1.  Posting several other snippets of code in the same code block displays correctly.
          The problem is specifically with this code snippet.
    -  1.  Posting the same code on a new post yields the same problem.
    -  1.  Turning on Code Escaping, for posts, in the Prsimatic preferences fixes 
          the problem. However, author images and other elements no longer display 
          correctly.
    -  1.  I’m using the latest versions of Autoptimize and W3 Total Cache. Clearing
          the cache yields the same results.
    -  1.  I have dozens of pages with code, posted in the same way. This is the only
          code/page causing issues.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684721)
 * So if I understand correctly:
    - The snippet that you posted above is the only one that is causing problems
    - The problem is resolved when code escaping is enabled
    - When code escaping is enabled there are problems with images and other elements
 * Does that sound correct? If so, what exactly is happening with the broken images/
   markup when escaping is enabled? Does it happen on any other posts/pages/snippets?
 *  Thread Starter [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684799)
 * Correct.
 * The main problems I noticed when turning on code escaping was that the author
   images on the “Recommended For You” posts where not displaying.
 * However, I just tested it again. After updating to the latest WordPress, the 
   author images display properly.
 * So yay! It looks to be fixed.
 * So why did I need to enable code escaping only for this code snippet? And what
   are the downsides to having code escaping for posts turned on? Will I have to
   turn on the code escaping for Content, Excerpts, and Comments? Because, if someone
   posted this same code in the comments, wouldn’t it cause the same issue? Thanks!
 *  Thread Starter [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684809)
 * I spoke too soon. After clearing the cache, the author images do not display.
   🙁
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684899)
 * Is there a page where I can view the images not displaying with escaping enabled?
   I need to be able to look at the markup to see what is happening.
 *  Thread Starter [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684923)
 * Yes. The example page I posted in my first post.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13684933)
 * Yeah I checked that. Looks fine to me in latest Chrome browser.
 *  Thread Starter [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13705547)
 * The images started showing for me as well. It might have been a cache issue.
 * After having escaping enabled for some time, I noticed another problem. All of
   my previous posts written prior to enabling escaping all have improperly encoded
   text.
 * I turned escaping off because all of my posts display the code properly, except
   for this one: [https://ingax.com/decoding-a-secret-message/](https://ingax.com/decoding-a-secret-message/)
 * Some cases are worse than others. In most cases, only the “->” are encoded improperly.
   In one case, it’s really bad.
 * [https://ingax.com/daily-coding-problem-61-asked-by-google/](https://ingax.com/daily-coding-problem-61-asked-by-google/)
 *     ```
       <span class="token keyword">func</span> <span class="token function">pow</span><span class="token punctuation">(</span><span class="token number">_</span> x <span class="token punctuation">:</span> <span class="token builtin">Int</span><span class="token punctuation">,</span> <span class="token number">_</span> y <span class="token punctuation">:</span> <span class="token builtin">Int</span><span class="token punctuation">)</span> <span class="token operator">-</span><span class="token operator">></span> <span class="token builtin">Int</span> <span class="token punctuation">{</span>
         <span class="token keyword">if</span> y <span class="token operator">==</span> <span class="token number">0</span> <span class="token punctuation">{</span> <span class="token keyword">return</span> <span class="token number">1</span> <span class="token punctuation">}</span>
         <span class="token keyword">let</span> power<span class="token punctuation">:</span> <span class="token builtin">Int</span> <span class="token operator">=</span> <span class="token function">pow</span><span class="token punctuation">(</span>x<span class="token punctuation">,</span> y<span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">)</span>
         <span class="token keyword">return</span> y <span class="token operator">%</span> <span class="token number">2</span> <span class="token operator">!=</span> <span class="token number">0</span> <span class="token operator">?</span> <span class="token punctuation">(</span>x <span class="token operator">*</span> power <span class="token operator">*</span> power<span class="token punctuation">)</span> <span class="token punctuation">:</span> <span class="token punctuation">(</span>power <span class="token operator">*</span> power<span class="token punctuation">)</span>
       <span class="token punctuation">}</span>
       ```
   
 * So back to my initial question. Why is this one snippet of code causing problems?
   Is it the closures I wrote?
 * Thank you!
    David
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13705825)
 * I don’t know. I tried posting that same snippet on default WP install and there
   are no escaping issues, everything displays properly. On your setup most likely
   there is something interfering with normal functionality, could be another plugin,
   the theme, etc. Difficult to guess without further investigation.
 *  Thread Starter [ingax](https://wordpress.org/support/users/ingax/)
 * (@ingax)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13711235)
 * I changed the problem page to a default code block for now. I’ll continue to 
   dig through the code to see what’s going on. Thanks for your help!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13714060)
 * Alright sounds good. I’ll go ahead and leave this thread open for awhile in case
   you find something, further questions, etc. Thank you [@ingax](https://wordpress.org/support/users/ingax/).
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13847175)
 * Hi [@ingax](https://wordpress.org/support/users/ingax/), just wanted to follow
   up with this. It’s been awhile with no reply, so I hope the issue is resolved?
   Or if there is anything I can do to help, please let me know. Thank you.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13858962)
 * Hey [@ingax](https://wordpress.org/support/users/ingax/), I hope you got this
   sorted. It’s been awhile with no reply so gonna go ahead and mark this thread
   as resolved to help keep the forum organized. Feel free to post again with any
   further questions or feedback, Thank you.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Code Escaping Problem – Only with one post so far.’ is closed to new 
replies.

 * ![](https://ps.w.org/prismatic/assets/icon-256x256.png?rev=1521267)
 * [Prismatic](https://wordpress.org/plugins/prismatic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prismatic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prismatic/)
 * [Active Topics](https://wordpress.org/support/plugin/prismatic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prismatic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prismatic/reviews/)

 * 14 replies
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/code-escaping-problem-only-with-one-post-so-far/#post-13858962)
 * Status: resolved