open-eats / OpenEats

:pizza: Self Hosted Recipe Management App :hamburger:
https://open-eats.github.io/
MIT License
670 stars 102 forks source link

Degree Character is causing 500 Internal Server Error #54

Open cearum opened 6 years ago

cearum commented 6 years ago

I tried to create a recipe with the following line (Copy and pasted from a recipe) and kept getting a 500 Internal Server Error. When I removed the degree characters it was Okay.

(Put in the directions) Preheat oven to 375˚F/190˚C .

Here is the chrome console output: VM270:1 POST https://recipes.{domain}.net/api/v1/recipe/recipes/ 500 (Internal Server Error) (anonymous) @ VM270:1 u.end @ client.js:772 u.end @ client.js:676 (anonymous) @ request-base.js:238 r.then @ request-base.js:237 (anonymous) @ RecipeFormActions.js:96 (anonymous) @ index.js:8 dispatch @ applyMiddleware.js:35 (anonymous) @ RecipeFormActions.js:45 (anonymous) @ index.js:8 (anonymous) @ bindActionCreators.js:3 a.submit @ RecipeForm.js:39 b @ react-dom.production.min.js:36 invokeGuardedCallback @ react-dom.production.min.js:35 invokeGuardedCallbackAndCatchFirstError @ react-dom.production.min.js:35 v @ react-dom.production.min.js:36 executeDispatchesInOrder @ react-dom.production.min.js:38 j @ react-dom.production.min.js:46 S @ react-dom.production.min.js:46 k @ react-dom.production.min.js:46 processEventQueue @ react-dom.production.min.js:49 handleTopLevel @ react-dom.production.min.js:57 x @ react-dom.production.min.js:43 batchedUpdates @ react-dom.production.min.js:190 @ react-dom.production.min.js:41 E @ react-dom.production.min.js:41 batchedUpdates @ react-dom.production.min.js:42 dispatchEvent @ react-dom.production.min.js:45

It says in this part of the code (It highlights n.apply(e, arugments)):

        function(t) {
            var e = this
              , o = r(t);
            return o && e.addEventListener("loadend", function() {
                s({
                    requestID: o,
                    statusCode: e.status
                })
            }),
            n.apply(e, arguments)
        }
RyanNoelk commented 6 years ago

Thanks for the report 👍

I had this same issue a few times as well. It's a problem with how the API/DB are saving the data that is causing issue.

I will take a deeper look into this.

cearum commented 6 years ago

As an addition I also noticed that it happens with the fraction characters as well: Doesn't work: "and set aside ¾ cup." Does work: "and set aside 3/4 cup."

RyanNoelk commented 5 years ago

After some investigation, look like it's a core MySQL issue (making me wish I had just used Postgres from the start). There seem to be some hacks that I can do to work around this, but right now it's not high on my list :(

You can try some of the few things below. I will also be working on some better error messaging See this for more info: https://code.djangoproject.com/ticket/13919

sepulzera commented 2 years ago

For anyone running into this issue: Older MariaDB versions are per default only using 3-bytes unicodes. If you are experiencing the mentioned issue, you should migrate to 4-bytes unicodes, or use a more recent version of MariaDB (10.7.3 seems to be working fine for me) from the beginning.