MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    MagicMirror² v2.20.0 is available! For more information about this release, check out this topic.

    SOLVED Character set for news fed text '

    Troubleshooting
    4
    12
    162
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      huskernut0878 last edited by

      Searched for this but I’m too new to know if I found anything. My news feed from fox news will not display an apostrophe character. If the word was Bob’s it shows Bob’s. I have no special configuration going to show you. How do I fix this?

      H J 2 Replies Last reply Reply Quote 0
      • H
        huskernut0878 @huskernut0878 last edited by

        @huskernut0878 well that didn’t work. It displays Bob ( the code for an apostrophe ) s

        S 1 Reply Last reply Reply Quote 0
        • S
          sdetweil @huskernut0878 last edited by

          @huskernut0878 you could try to change the character encoding
          see
          https://docs.magicmirror.builders/modules/newsfeed.html#configuration-options

          Sam

          Create a working config
          How to add modules

          H 1 Reply Last reply Reply Quote 0
          • H
            huskernut0878 @sdetweil last edited by

            @sdetweil thank you, that did not make a difference.

            S 1 Reply Last reply Reply Quote 0
            • S
              sdetweil @huskernut0878 last edited by

              @huskernut0878 there is a similar issue open

              https://github.com/MichMich/MagicMirror/issues/2712

              the possible fix seems to open a big security exposure

              Sam

              Create a working config
              How to add modules

              1 Reply Last reply Reply Quote 0
              • J
                J_Joe @huskernut0878 last edited by J_Joe

                @huskernut0878
                I had the same frustrating issue - here’s my solution -

                I actually made a fix for this that works fine for me - Not sure how to present it - but in the newsfeed.js make the following changes

                1. At the end of the defaults of the newsfeed.js add the line replaceMe: [] as shown below -

                  logFeedWarnings: false,
                  replaceMe: []       
                  

                  },

                2. In the getTemplateData: function () { add the following before the return { loaded: true,

                  basically everything in the jep section all between the //*******
                  return item;

                   });
                   //*******
                   //jep  to fix title for various translations such as
                   // a simple ' instead of showing '
                   // also replace things like Seattle with Seattle, WA
                   var tempTitle = item.title; 
                  
                   for(let i = 0; i <  this.config.replaceMe.length; i+= 2)
                   {
                       tempTitle = tempTitle.toString().replaceAll(this.config.replaceMe[i], this.config.replaceMe[i+1]);
                   }
                   //**********************
                  
                   return {
                       loaded: true,
                  

                2A. In the return section -add the jep line as shown below
                publishDate: moment(new Date(item.pubdate)).fromNow(),
                title: tempTitle, //jep see above
                description: item.description,

                1. Finally - in your config.js - the area for the newsfeed - at the end add this and edit it for the items you want changed…
                replaceMe: [ "&apos;", "'", "Seattle", "Seattle, WA", "Biden", "(Pres) Biden",  "Zuckerberg", "Zuckerberg [DATA]"]
                

                (sam, edited to add code block, which preserves the style of the quotes, else u get word processing style, which breaks config.js))

                This will replace the 1st item with the 2nd item, etc… Add whatever translations you want (: I’ve had some fun with the replacements…

                S B H 3 Replies Last reply Reply Quote 0
                • S
                  sdetweil @J_Joe last edited by

                  @j_joe u should propose that as a fix for the above listed issue…

                  moves control to the user, and eliminates a possible hack exposure

                  Sam

                  Create a working config
                  How to add modules

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    J_Joe @sdetweil last edited by

                    @sdetweil
                    Not sure how to do that (:

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      sdetweil @J_Joe last edited by

                      @j_joe go to the link, and add a comment to the existing issue on how you solved this…
                      copy your info here, there in the comment

                      Sam

                      Create a working config
                      How to add modules

                      J 1 Reply Last reply Reply Quote 0
                      • J
                        J_Joe @sdetweil last edited by

                        @sdetweil

                        Got it - thank you. Done.
                        I hope my solution works for people. It’s been great for me and my needs! And it’s simple. How ever many items are in the array - it will look for them and replace them as dictated by the array…

                        1 Reply Last reply Reply Quote 1
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy