Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:01:05+00:00 2026-05-26T06:01:05+00:00

I have a git repository that has a UTF-16 file in it. Its only

  • 0

I have a git repository that has a UTF-16 file in it. Its only UTF-16 by accident, the file could be encoded in 7-bit ascii without a loss of data. I’d like to use something like reposurgeon to convert the file to UTF-8 so that git diff will work with older revisions of the file and I don’t have to resort to git difftool. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:01:05+00:00Added an answer on May 26, 2026 at 6:01 am

    Why don’t you just covert the file to UTF-8 and commit it, e.g. with:

    iconv -f UTF-16 -t UTF-8 input-file.txt > input-file.txt.fixed
    # Check here that the conversion worked OK
    mv -i input-file.txt.fixed input-file.txt
    git commit -m 'Convert input-file.txt from UTF-16 to UTF-8' input-file.txt
    

    Update after a clarifying comment:

    If you want to rewrite that file at every commit in the history of HEAD, you can use git filter-branch, something like:

    git filter-branch --tree-filter \
        'iconv -f UTF-16 -t UTF-8 input-file.txt > input-file.txt.fixed  &&
         mv input-file.txt.fixed input-file.txt' HEAD
    

    Of course, if you’re rewriting history in this way, it may cause problems if you have shared this repository with anyone. (I haven’t tested that command – use it with care, probably only a new clone of your repository.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Git repository that has branch (local and remote) that has become
I have a large git repository that I am hosting with Dreamhost. It has
I have a git repository, which has changes that I am slowly bringing into
I have a central git repository that everyone pushes to for testing and integration,
I have some old branches in my git repository that are no longer under
I have a folder in my Git repository that I'd like to move out
I have a project A that is a Git repository. I would like to
I am new to git, and have a subversion repository that I want to
I have a Git repository that contains a bunch of top-level maven projects (each
I have a git repository that I am using and I've screwed up. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.