Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Technically correct but practically useless

Technically correct but practically useless

Scheduled Pinned Locked Moved The Lounge
csharpc++iotquestion
21 Posts 9 Posters 2 Views 1 Watching
  • 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.
  • honey the codewitchH Offline
    honey the codewitchH Offline
    honey the codewitch
    wrote on last edited by
    #1

    So I'm wrapping this

    The quick brown fox jumped over the lazy dog

    And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

    The quick
    brown
    fox jumped
    over the
    lazy dog

    Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

    To err is human. Fortune favors the monsters.

    Sander RosselS L Richard DeemingR B T 6 Replies Last reply
    0
    • honey the codewitchH honey the codewitch

      So I'm wrapping this

      The quick brown fox jumped over the lazy dog

      And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

      The quick
      brown
      fox jumped
      over the
      lazy dog

      Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

      To err is human. Fortune favors the monsters.

      Sander RosselS Offline
      Sander RosselS Offline
      Sander Rossel
      wrote on last edited by
      #2

      I have a simple(r) solution. Print the character to an image (in-memory, obviously). Now connect to some OCR service and let it scan the image. If the result is null, "", " " or " " it's whitespace. Just thinking outside the box :D

      Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

      honey the codewitchH 1 Reply Last reply
      0
      • honey the codewitchH honey the codewitch

        So I'm wrapping this

        The quick brown fox jumped over the lazy dog

        And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

        The quick
        brown
        fox jumped
        over the
        lazy dog

        Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

        To err is human. Fortune favors the monsters.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hmmm, Can you go into technical details about the difficulties? I can't figure out why you need 'a massive table'.

        CPalliniC honey the codewitchH 2 Replies Last reply
        0
        • L Lost User

          Hmmm, Can you go into technical details about the difficulties? I can't figure out why you need 'a massive table'.

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          I guess the table is in the Remarks section of Char.IsWhiteSpace Method (System) | Microsoft Docs[^].

          "In testa che avete, Signor di Ceprano?" -- Rigoletto

          In testa che avete, signor di Ceprano?

          L 1 Reply Last reply
          0
          • honey the codewitchH honey the codewitch

            So I'm wrapping this

            The quick brown fox jumped over the lazy dog

            And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

            The quick
            brown
            fox jumped
            over the
            lazy dog

            Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

            To err is human. Fortune favors the monsters.

            Richard DeemingR Offline
            Richard DeemingR Offline
            Richard Deeming
            wrote on last edited by
            #5

            Does the OS you're using not have ICU[^] support built-in?


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

            CPalliniC honey the codewitchH 2 Replies Last reply
            0
            • CPalliniC CPallini

              I guess the table is in the Remarks section of Char.IsWhiteSpace Method (System) | Microsoft Docs[^].

              "In testa che avete, Signor di Ceprano?" -- Rigoletto

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I was looking at the table over at Unicode.org[^]

              CPalliniC 1 Reply Last reply
              0
              • L Lost User

                I was looking at the table over at Unicode.org[^]

                CPalliniC Offline
                CPalliniC Offline
                CPallini
                wrote on last edited by
                #7

                I guess they match. :-)

                "In testa che avete, Signor di Ceprano?" -- Rigoletto

                In testa che avete, signor di Ceprano?

                1 Reply Last reply
                0
                • Richard DeemingR Richard Deeming

                  Does the OS you're using not have ICU[^] support built-in?


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Many IoT devices, don't have an OS.

                  "In testa che avete, Signor di Ceprano?" -- Rigoletto

                  In testa che avete, signor di Ceprano?

                  1 Reply Last reply
                  0
                  • honey the codewitchH honey the codewitch

                    So I'm wrapping this

                    The quick brown fox jumped over the lazy dog

                    And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

                    The quick
                    brown
                    fox jumped
                    over the
                    lazy dog

                    Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

                    To err is human. Fortune favors the monsters.

                    B Offline
                    B Offline
                    BorkenkaeferFrisstFichten
                    wrote on last edited by
                    #9

                    The correct phrase is: the quick brown fox jumps over the lazy dogs back 0123456789 That was the final test the engineer made after the telex device had been installed at the customer's premises. The funny "phrase" contains all characters a Telex had to be able to receive and transmit correctly via POTS using its very own error-correction. At the time this was relevant, it was very much useful as it had been an industry standard procedure. It was also used for testing serial terminals' keyboards.

                    honey the codewitchH 1 Reply Last reply
                    0
                    • Richard DeemingR Richard Deeming

                      Does the OS you're using not have ICU[^] support built-in?


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      honey the codewitchH Offline
                      honey the codewitchH Offline
                      honey the codewitch
                      wrote on last edited by
                      #10

                      What OS? FreeRTOS? No. And it wouldn't know what to do with truetype anyway. It has no concept of graphics

                      To err is human. Fortune favors the monsters.

                      1 Reply Last reply
                      0
                      • B BorkenkaeferFrisstFichten

                        The correct phrase is: the quick brown fox jumps over the lazy dogs back 0123456789 That was the final test the engineer made after the telex device had been installed at the customer's premises. The funny "phrase" contains all characters a Telex had to be able to receive and transmit correctly via POTS using its very own error-correction. At the time this was relevant, it was very much useful as it had been an industry standard procedure. It was also used for testing serial terminals' keyboards.

                        honey the codewitchH Offline
                        honey the codewitchH Offline
                        honey the codewitch
                        wrote on last edited by
                        #11

                        Mine was accurate, just truncated at the s :laugh:

                        To err is human. Fortune favors the monsters.

                        1 Reply Last reply
                        0
                        • Sander RosselS Sander Rossel

                          I have a simple(r) solution. Print the character to an image (in-memory, obviously). Now connect to some OCR service and let it scan the image. If the result is null, "", " " or " " it's whitespace. Just thinking outside the box :D

                          Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                          honey the codewitchH Offline
                          honey the codewitchH Offline
                          honey the codewitch
                          wrote on last edited by
                          #12

                          *angeryface* :mad:

                          To err is human. Fortune favors the monsters.

                          1 Reply Last reply
                          0
                          • L Lost User

                            Hmmm, Can you go into technical details about the difficulties? I can't figure out why you need 'a massive table'.

                            honey the codewitchH Offline
                            honey the codewitchH Offline
                            honey the codewitch
                            wrote on last edited by
                            #13

                            The table isn't as big as a thought. A long time ago I wrote something to spit out character class tables, and I thought I remembered the whitespace one being huge. It's not, now that I looked it up. Still, it's larger than I'd like.

                            To err is human. Fortune favors the monsters.

                            L 1 Reply Last reply
                            0
                            • honey the codewitchH honey the codewitch

                              The table isn't as big as a thought. A long time ago I wrote something to spit out character class tables, and I thought I remembered the whitespace one being huge. It's not, now that I looked it up. Still, it's larger than I'd like.

                              To err is human. Fortune favors the monsters.

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #14

                              honey the codewitch wrote:

                              Still, it's larger than I'd like.

                              I don't think you need to check for all of them. I think you can get away with just 12. isWhitespace[^] Btw, now that .NET is using ICU[^] this should match the C# behavior. (I just checked ICU docs to confirm)

                              honey the codewitchH 1 Reply Last reply
                              0
                              • honey the codewitchH honey the codewitch

                                So I'm wrapping this

                                The quick brown fox jumped over the lazy dog

                                And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

                                The quick
                                brown
                                fox jumped
                                over the
                                lazy dog

                                Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

                                To err is human. Fortune favors the monsters.

                                T Offline
                                T Offline
                                TheRealSteveJudge
                                wrote on last edited by
                                #15

                                No idea, but shouldn't it be "The quick brown fox jumps over the lazy dog"? :laugh:

                                M 1 Reply Last reply
                                0
                                • L Lost User

                                  honey the codewitch wrote:

                                  Still, it's larger than I'd like.

                                  I don't think you need to check for all of them. I think you can get away with just 12. isWhitespace[^] Btw, now that .NET is using ICU[^] this should match the C# behavior. (I just checked ICU docs to confirm)

                                  honey the codewitchH Offline
                                  honey the codewitchH Offline
                                  honey the codewitch
                                  wrote on last edited by
                                  #16

                                  Yeah, but I'm not using .NET, and my platform doesn't understand unicode beyond wchar_t which I can't even use.

                                  To err is human. Fortune favors the monsters.

                                  L 1 Reply Last reply
                                  0
                                  • honey the codewitchH honey the codewitch

                                    Yeah, but I'm not using .NET, and my platform doesn't understand unicode beyond wchar_t which I can't even use.

                                    To err is human. Fortune favors the monsters.

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #17

                                    honey the codewitch wrote:

                                    Yeah, but I'm not using .NET, and my platform doesn't understand unicode

                                    Nobody in this thread thinks you are using .NET I'm saying that you can write a C function for your IoT device that will duplicate Java and C# whitespace behavior simply by checking for those 12 values. They are all doing the same thing as ICU.

                                    honey the codewitchH 1 Reply Last reply
                                    0
                                    • L Lost User

                                      honey the codewitch wrote:

                                      Yeah, but I'm not using .NET, and my platform doesn't understand unicode

                                      Nobody in this thread thinks you are using .NET I'm saying that you can write a C function for your IoT device that will duplicate Java and C# whitespace behavior simply by checking for those 12 values. They are all doing the same thing as ICU.

                                      honey the codewitchH Offline
                                      honey the codewitchH Offline
                                      honey the codewitch
                                      wrote on last edited by
                                      #18

                                      Ohhhh thanks. Sorry, it was early and I was still a bit slow. I'll do that.

                                      To err is human. Fortune favors the monsters.

                                      1 Reply Last reply
                                      0
                                      • honey the codewitchH honey the codewitch

                                        So I'm wrapping this

                                        The quick brown fox jumped over the lazy dog

                                        And I've traversed all the nastiness with Unicode's non-breaking spaces, and invisible breaks and all of that. I get this:

                                        The quick
                                        brown
                                        fox jumped
                                        over the
                                        lazy dog

                                        Look at the 2nd line. "Oh just remove the whitespace around the line" they said "It will be easy" they said "You can call char.IsWhitespace()" except wait. This isn't .NET. It's an IoT machine with C++ C++ doesn't do 32-bit codepoints out of the box. Do have any idea how hard it is to determine if a character is whitespace in Unicode? I need a massive table. *headdesk*

                                        To err is human. Fortune favors the monsters.

                                        P Offline
                                        P Offline
                                        PIEBALDconsult
                                        wrote on last edited by
                                        #19

                                        For part of my UTF-8 decoder I use a sparse array, but of course I'm using C# so I can catch Index Exceptions. I guess I now have to add more characters to it though.

                                        1 Reply Last reply
                                        0
                                        • T TheRealSteveJudge

                                          No idea, but shouldn't it be "The quick brown fox jumps over the lazy dog"? :laugh:

                                          M Offline
                                          M Offline
                                          megaadam
                                          wrote on last edited by
                                          #20

                                          TheRealSteveJudge wrote:

                                          jumps

                                          I think you must've solved it!

                                          "If we don't change direction, we'll end up where we're going"

                                          T 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups