Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, coding and Scratching guys,

as you saw, my website returns:

Response
///////////////////////////////////
// CODED BY RIX                  //
// DO NOT EDIT YOURSELF          //
// TO ADD SOMEONE, WRITE TO CHAT //
///////////////////////////////////

class Scratchables {
	getInfo() {
		return {
			color1: "#f9a83a",
			color2: "#c7862e",
			id: "Scratchables",
			name: "Scratchables!",
			description: "A collab between Scratchers 'n' Replers made by Rix",
			blocks: [
				{
					opcode: "rix",
					blockType: Scratch.BlockType.REPORTER,
					text: ":>°^",
					arguments: {}
				}
			]
		}
	}
	rix(args) {
		return "\n"
	}
}

Scratch.extensions.register(new Scratchables())


Notice that ":>°^", that it's not ":>°^"? Because, in the script, it is ":>°^"... Oh, and, um, here's my code:

main.py
########################
# CODED BY RIX         #
# DO NOT EDIT YOURSELF #
########################

from flask import Flask, make_response, send_from_directory
app = Flask("app")

@app.route("/")
def main():
	resp = make_response(open("source.js", "r", encoding="utf-8").read().replace("Â", ""))
	print(resp.headers)
	resp.headers["content-type"] = resp.headers["accept"] = "text/javascript"
	resp.headers["content-type"] += "; charset=utf8"
	print(resp.headers)
	return resp

@app.route("/<path:file>")
def source(file):
	return send_from_directory(".", "source.js")

app.run(host="0.0.0.0", port=8080)


What I have tried:

                              
Posted
Updated 23-Jun-22 4:56am
v3
Comments
Member 15627495 23-Jun-22 5:44am    
maybe due to UTF-8 misuse, really write your file as utf-8 encoding type.

other writing leads to weird display. ....
Tyrunt.new("Rix") 23-Jun-22 10:31am    
I used encoding="utf-8" in the reading part but it doesn't work...
Tyrunt.new("Rix") 23-Jun-22 10:26am    
How can I set it to UTF8?

1 solution

Simply retype the mess                              
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900