Title: Encoding error while executong code from CodeMirror block.
Last modified: July 9, 2021

---

# Encoding error while executong code from CodeMirror block.

 *  Resolved [pcskull](https://wordpress.org/support/users/pcskull/)
 * (@pcskull)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/encoding-error-while-executong-code-from-codemirror-block/)
 * I’m implementing an online Python compiler for which I am using codemirror. When
   I try to execute the code from codemirror block, it is giving an error.
 * [https://www.csestack.org/for-loop-else-empty-django-template/](https://www.csestack.org/for-loop-else-empty-django-template/)
 * Here you can see the codemirror block and “Run” button.
 * On clicking “Run” button, I’m sharing code with our designed online IDE through
   localstorage.
 * Executing code in an online compiler giving us an error as
 * ———
    File “script.py”, line 1 SyntaxError: Non-UTF-8 code starting with ‘\x87’
   in file script.py on line 1, but no encoding declared; see [http://python.org/dev/peps/pep-0263/](http://python.org/dev/peps/pep-0263/)
   for details ——–
 * Looks like this is encoding issue. Please guide us.

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

 *  Plugin Author [Vicky Agravat](https://wordpress.org/support/users/vickyagravat/)
 * (@vickyagravat)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/encoding-error-while-executong-code-from-codemirror-block/#post-14647721)
 * Hey [@pcskull](https://wordpress.org/support/users/pcskull/)
 * I have checked your site.
 * You are using local storage to copy code data at: [https://www.csestack.org/for-loop-else-empty-django-template/](https://www.csestack.org/for-loop-else-empty-django-template/)
   from code block, when Execute Code button is clicked. and new page will open 
   with copied code in the IDE at: [https://www.csestack.org/ide/](https://www.csestack.org/ide/)
   
   This is perfectly fine.
 * Case 1
 * But, I have find one problem here, The language select dropdown is not pre selected
   with Python, by default it is selected with C language.
 * That may be a problem.
    Before changing the language selector i click Execute
   button, i got encoding error in response of the request.
 * But, after change the language selector dropdown to Python 3 or Python 2 and 
   click Execute button, I will get expected output.
 * Case 2
 * If you still get error after Python 3 or Python 2 is as selected language, There
   may be problem when you are convert the code string into base64 encoding.
 * It may get any extra whitespace or other non printable character at the beginning
   of the string.
 * What you should do?
 * You can check decoded string result at: [https://executecode.csestack.org/submissions?base64_encoded=true](https://executecode.csestack.org/submissions?base64_encoded=true)
   on your server side. you can check is there any unexpected character in the string,
   before compilation.
    I think this should work.
 * Please Note: This forum is not for this type of question. Because, it is totally
   custom work.
 * If you want to get any extra help from me, Skype Me: live:vicky.agravat
    Thank
   you.
 *  Thread Starter [pcskull](https://wordpress.org/support/users/pcskull/)
 * (@pcskull)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/encoding-error-while-executong-code-from-codemirror-block/#post-14647804)
 * Thanks for your kind reply and this awesome plugin. The issue is resolved. There
   was some encoding issue. And sorry for using this space to ask the question. 
   Marking this as resolved.
 *  Plugin Author [Vicky Agravat](https://wordpress.org/support/users/vickyagravat/)
 * (@vickyagravat)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/encoding-error-while-executong-code-from-codemirror-block/#post-14647898)
 * Hello [@pcskull](https://wordpress.org/support/users/pcskull/)
 * Good to know that you have resolved the problem.
 * If you like the plugin, you can leave review with good rating.
 * Thank you.

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

The topic ‘Encoding error while executong code from CodeMirror block.’ is closed
to new replies.

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

 * 3 replies
 * 2 participants
 * Last reply from: [Vicky Agravat](https://wordpress.org/support/users/vickyagravat/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/encoding-error-while-executong-code-from-codemirror-block/#post-14647898)
 * Status: resolved