Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Part of the do file suddenly changed to strange characters

    The do file works well for a long period of time. Yesterday, I run the do file and save it on a laptop. Today, when I reopen the do file, the stata warmed that "the document is not encoded in UTF-8". I found that part of (around 270 lines) of the do files changed to strange characters. I also cannot used unicode translate to translate the do file into normal characters. I spent a whole day trying to figure out, but still cannot find a solution. What can I do now?

  • #2
    Try opening the file with Notepad++ (different from the regular notepad). That program allows you to manually define the encoding. Play around a bit with the encoding options that make sense and with some luck it'll look normal in one of them. Then you might be able to copy what you get into a new dofile.

    Comment


    • #3
      I don't fully understand what your situation is or what software you used on this do file, but you may find the -filefilter- command helpful:
      Code:
      help filefilter

      Comment


      • #4
        Originally posted by Jesse Wursten View Post
        Try opening the file with Notepad++ (different from the regular notepad). That program allows you to manually define the encoding. Play around a bit with the encoding options that make sense and with some luck it'll look normal in one of them. Then you might be able to copy what you get into a new dofile.
        Thanks Jesse. However, I tried all the encoding options at Notepad++, but none of the encodings works.

        Comment


        • #5
          Originally posted by Rich Goldstein View Post
          I don't fully understand what your situation is or what software you used on this do file, but you may find the -filefilter- command helpful:
          Code:
          help filefilter
          Thanks Rich. I am using stata 15 on this do file. All of a sudden, about 200 lines of command became strange characters. I just do know why, and cannot find a way to deal with it. It seems filefilter works for files, and I should know the encoding beforehand. But I donot even know the encoding of the strane chacters now.

          Comment


          • #6
            are you saying that you used the Stata do-file editor and, when you were using that, the changes occurred? if yes, you need to contact tech-support at [email protected]; if that is not what you are saying I remain confused; -filefilter- will work on do files (in case you were saying that it would not); you can get the encoding of the "strange" characters using the -hexdump- command;
            Code:
            help hexdump

            Comment


            • #7
              Originally posted by Rich Goldstein View Post
              are you saying that you used the Stata do-file editor and, when you were using that, the changes occurred? if yes, you need to contact tech-support at [email protected]; if that is not what you are saying I remain confused; -filefilter- will work on do files (in case you were saying that it would not); you can get the encoding of the "strange" characters using the -hexdump- command;
              Code:
              help hexdump
              Hi Rich. The changed occured when I reopned the saved do file. I have already sent an email to [email protected], but have not gotten reponse yet.

              Comment


              • #8
                Originally posted by Weiwen Li View Post
                The do file works well for a long period of time. Yesterday, I run the do file and save it on a laptop.
                On the off chance, you wouldn't have another (say, backup) copy on another machine (for example, the company or university server) or USB flash drive, would you?

                Comment


                • #9
                  Originally posted by Joseph Coveney View Post
                  On the off chance, you wouldn't have another (say, backup) copy on another machine (for example, the company or university server) or USB flash drive, would you?
                  Hi Joseph. Unfortunately, I do not have any copy of the do file anywhere.

                  Comment


                  • #10
                    Yeow! Can you reconstruct the lost commands from the log file?

                    Comment


                    • #11
                      Originally posted by Joseph Coveney View Post
                      Yeow! Can you reconstruct the lost commands from the log file?
                      Hi Joseph. Thank for your prompt reply. The worst thing is that I did not keep a log file for the command.

                      Comment

                      Working...
                      X