sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    [Code] PCFileTools

    Scheduled Pinned Locked Moved Developers' Forum
    27 Posts 3 Posters 4.2k Views 3 Watching
    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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      from the old Pick-axe Book:

      @unknownuser said:

      Strings are stored as sequences of 8-bit bytes,[For use in Japan, the jcode library supports a set of operations of strings written with EUC, SJIS, or UTF-8 encoding. The underlying string, however, is still accessed as a series of bytes.] and each byte may contain any of the 256 8-bit values, including null and newline. The substitution mechanisms in Table 18.2* on page 203 allow nonprinting characters to be inserted conveniently and portably.

      • refers to the table of ** codes

      Also Standard Types: Strings


      So it seems that (in my mind,) since Sketchup sets $KCODE to UTF8 when it loads the interpreter, we may not actually have as much of a problem on the Rubyside as I thought.

      So we have a choice...

      1) A pure-Ruby patch, that either accesses the system calls (for File functions,) via WIN32OLE or WIN32API (the so libraries.)

      2) A compiled C patch, ie: "Cut out" the c code files that define classes IO, Dir and File (perhaps also FileTest,) and recompile with either UNICODE #defined, or change the C function calls explicitly to the wide versions. These would be ".so" files, and they would redefine the old methods. (What happens on the C-side when you re-define a C function that has already been defined? Do the C functions that the new Ruby wrappers call, need to be renamed as well?)


      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        I was thinking that a C extension that did most of the functions used, like File.exist?, read, write, delete and list files in folders would go a long way. It wouldn't be as extensive as a complete rewrite - therefor more quicker to develop. Then off course not replacing the existing methods - as it'd just open up a vast pool of possible problems which would require even more testing and development.

        Trying to rewrite the entire File, Dir and IO classes to call the W variant file function just seems like such a massive undertaking that it'd probably never be completed.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          Does Sketchup set $KCODE to "UTF8" in all locales - I know it does in UK/US and probably European language locales BUT what about Chinese ? I'll ask someone...
          If we get a consistent code for their locale can we modify the pack/join code to say use 'u' not 'U' and get an appropriate conversion in different $KCODE cases ?

          TIG

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @thomthom said:

            Then of course not replacing the existing methods - as it'd just open up a vast pool of possible problems which would require even more testing and development.

            Well what I said before still goes... The new class(es) are in a Library namespace, need to be require(d), and then referenced within an author's namespace via an alias, (as I showed in the examples above.)

            I mispoke when I said redefine, they would have the same identifiers, but be within, say SKX::WIN module namespace.

            @thomthom said:

            Trying to rewrite the entire File, Dir and IO classes to call the W variant file function just seems like such a massive undertaking that it'd probably never be completed.

            I was hoping (without yet digging into the C source,) that it might be easy to use Notepad++ search and replace to stick "W" where they need to be.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @dan rathbun said:

              @thomthom said:

              Trying to rewrite the entire File, Dir and IO classes to call the W variant file function just seems like such a massive undertaking that it'd probably never be completed.

              I was hoping (without yet digging into the C source,) that it might be easy to use Notepad++ search and replace to stick "W" where they need to be.

              Don't think it's that easy. I think there's a few type definitions that also needs to be adjusted. And then you need to ensure that there's no hard coded struct or data type sizes used...

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                Poking around, finding links to help Adam on his Hebrew webdialog problem, I ran across a link on the Wikipedia Windows Code Pages doc.

                Down at the bottom:

                @unknownuser said:

                See also


                AppLocale — a utility to run non-Unicode (code page-based) applications in a locale of the user's choice.

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  BUMP

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • 1
                  • 2
                  • 2 / 2
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement