Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Http-Request Senden in ISO-8859-1 statt UTF-8

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Http-Request Senden in ISO-8859-1 statt UTF-8

    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      ak68 last edited by

      Hallo zusammen,

      ich möchte folgenden http-Request zu EDOMI senden (DWD-Abfrage):

      8873_2018_12_16_10_35_42_window.png

      8873_2018_12_16_10_30_14_window.png

      Dies funktioniert auch, jedoch kommt der String UTF-8 statt ISO-8859-1 codiert an, was zum Verlust der Umlaute und Sonderzeichen führt:

      8873_2018_12_16_10_32_23_window.png

      Wie kann ich einen http-Request ausführen indem ich ISO-8859-1- Codierung erzwinge (statt einem Umwandlung in UTF-8) ?

      Ich haben schon folgendes in den Code eingefügt- OHNE Erfolg:

      var DWD_Abfrage;
          options = {
              headers: {
                  'Accept-Charset': 'iso-8859-1'
              }
          }
      
      

      Danke für Euere Bemühungen

      1 Reply Last reply Reply Quote 0
      • A
        ak68 last edited by

        Leider haben auch folgende Änderung im Javascript keine Veränderung gebracht:

        escape (...)
        encodeURI (...)
        encodeURIComponent (...)

        Wer weiss Rat ???

        1 Reply Last reply Reply Quote 0
        • Stabilostick
          Stabilostick last edited by

          Neugierig: kommt da ein json zurück, dass dann die Sonderzeichen enthält?

          a200 1 Reply Last reply Reply Quote 0
          • a200
            a200 @Stabilostick last edited by a200

            @Stabilostick sagte in Http-Request Senden in ISO-8859-1 statt UTF-8:

            Neugierig: kommt da ein json zurück, dass dann die Sonderzeichen enthält?

            Ja, und im Normalfall steht da ein Quadrat als nicht darstellbares Zeichen und die Umlaute sind futsch.

            1 Reply Last reply Reply Quote 0
            • Stabilostick
              Stabilostick last edited by Stabilostick

              Als Idee:

              var Buffer = require('buffer').Buffer;
              var Iconv  = require('iconv').Iconv;
              var tempBuffer = new Buffer(response.body, 'iso-8859-1');
              var iconv = new Iconv('ISO-8859-1', 'UTF-8');
              var tempBuffer = iconv.convert(tempBuffer);
              

              Oder halt anders herum. Es kann aber auch in die Hose gehen, da ich nicht weiß, wie das JSON in der JavaScript-Variablen gespeichert wird.

              Quelle: https://github.com/bnoordhuis/node-iconv

              A 1 Reply Last reply Reply Quote 0
              • A
                ak68 @Stabilostick last edited by ak68

                Ich habe´s jetzt so versucht, bekomme aber noch keinen Ausgangswert, wo ist mein Fehler ?

                a863c6a6-1ea9-4fd4-b68a-fcada2bf5143-image.png

                9d690da1-5db5-4720-b860-2fb10ae14d3f-image.png

                Auch bei Variante 2 (als Javascript) bekomme ich keinen Ausgangswert (encodeURIComponent zugefügt !):

                3ae8813e-3e6d-4e9b-88a4-8d54831ddee7-image.png

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                Support us

                ioBroker
                Community Adapters
                Donate
                FAQ Cloud / IOT
                HowTo: Node.js-Update
                HowTo: Backup/Restore
                Downloads
                BLOG

                621
                Online

                31.8k
                Users

                80.0k
                Topics

                1.3m
                Posts

                3
                6
                1457
                Loading More Posts
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes
                Reply
                • Reply as topic
                Log in to reply
                Community
                Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                The ioBroker Community 2014-2023
                logo