Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


vbs file encoding UTF8 / UTF16

vbs file encoding UTF8 / UTF16

vbs file encoding UTF8 / UTF16

I Have a bunch of vbs files that are in the UTF8 format stored in Github.
When adding files to github, all the encoding is committed in UTF8, however, I am working with languages, and some of the arrays are in other languages, requiring UTF16 encoding. Does it makes sense to check this in as UTF8 to maintain the github integrity and convert the file to UTF16? (Does that make sense? does that lose anything?) Or just get it checked in as UTF16? Hope that made sense.

thanks in advance.

RE: vbs file encoding UTF8 / UTF16

It really depends on whether cscript can understand UTF16 encoded files. Are you talking UTF16 or UCS-2 (what MS calls Unicode).

RE: vbs file encoding UTF8 / UTF16

The scripts are executed by HP's UFT, which is 16bit. The scripts are stored in GIT as UTF8. Perhaps I should just keep the language files stored in git under UTF16 (UCS-2) rather than in UTF8 and convert the file to UTF16 before execution? (I know it sounds odd, but trying to figure a way out to not mix files in git) Thanks again for the reply!

RE: vbs file encoding UTF8 / UTF16

There was a bug with UTF16 on github mentioned in https://github.com/Microsoft/vscode/issues/18680 It may have been fixed or it may be outstanding.

git itself works with UCS-2LE files. We have some files in C++ with Arabic, Chinese and Russian, encoded in UCS-2LE and we can get them in and out without any problems. I've never tried it with vbscript. Why not just try one and see. In the worst case, it will be treated as a binary file and you can't get any diffs.

RE: vbs file encoding UTF8 / UTF16

Cool, thanks for that info.

Side note, did you need anything special in git "config" or "gitattributes" files for your diffs to not look all spaced out?

RE: vbs file encoding UTF8 / UTF16

Which tool are you using for diff? Is it something unixy like vim or meld or is it something like windiff or something else?

Anyway, each tool has its own config for utf16.

RE: vbs file encoding UTF8 / UTF16

Using KDiff3 which seems to work well for this case, but github will display "Binary file not shown." in the PR, so no diff is shown.

RE: vbs file encoding UTF8 / UTF16

Have a look at https://stackoverflow.com/a/28102209/2041317

Remember to add a blank line at the end of your source file. Some source code control systems take a blank line to mean non-binary and the absence of a blank line to mean binary.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close