Request: Ability to change Encoding of each side file

Support for our DiffMerge utility.

Moderator: SourceGear

Post Reply
vbprof1984
Posts: 2
Joined: Mon Jul 13, 2009 12:00 am

Request: Ability to change Encoding of each side file

Post by vbprof1984 » Mon Jul 13, 2009 12:05 am

Hi,

Thanks for your precious DiffMerge tool. I'm dealing with c++ source code files that has unicode, utf8, and ascii strings. Sometimes DiffMerge doesn't know the right encoding of both opened files for comparison. I need a way to change the encoding the tool used to open the file so strings would appear correctly.

Thanks again :)

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: Request: Ability to change Encoding of each side file

Post by jeffhostetler » Mon Jul 13, 2009 7:05 am

Open the "Options" Dialog and click on the "Rulesets" Page.
Select the "C++ Ruleset" and click on "Edit".
Click on the "Character Encodings" Page.
And lets look at the settings on that page:

If the Unicode/UTF-8 versions of the files have Unicode Byte-Order-Marks, they
should be detected automatically and the Unicode and UTF-8 files automatically
recognized. (Just make sure the "Search for Unicode BOM" is enabled. And the
fallback encoding is either "Local/Default" or "Named" and something like "ISO-8859-1".)

If your files don't have (or don't always have) BOMs, then you can use
Select "Ask for Each File in Each Window". This will show you a dialog and ask you
to choose an encoding for each file as it is opened. (It'll show you the raw byte
values of the first ~1K of the file to help you choose.) Leave the "Search for BOM"
turned on so that it can handle the ones that are marked for you.

Let me know if this doesn't take care of the problem or if you have additional
questions.

jeff

vbprof1984
Posts: 2
Joined: Mon Jul 13, 2009 12:00 am

Re: Request: Ability to change Encoding of each side file

Post by vbprof1984 » Tue Jul 14, 2009 9:52 am

Thank you very much for your help. It worked with the options of "Ask for Each File in Each Window".

My problem was that one of my two files was in ANSI and the other was encoded in "Unicode (UTF-8 without signature) - Codepage 65001" and so Diffmerge could not recognize the correct encoding. I'd suggest researching this problem as I noticed that Notepad can recognize the encoding.

many thanks.

Ahmed

jeffhostetler
Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
Contact:

Re: Request: Ability to change Encoding of each side file

Post by jeffhostetler » Tue Jul 14, 2009 10:12 am

thanks for the update. glad to hear that you got everything working properly.

FWIW, if your files are always only utf-8 or ansi, you might try changing the character encoding
on the ruleset dialog to force utf-8. the ansi files (if they don't have any high-bit
characters) will read just fine using the utf-8 importer. this might save you the
trouble of picking the encodings each time a window is opened. DiffMerge will then
try the utf-8 encoding first and only ask you to pick one if it fails.

i'll log a bug to investigate better detection of ansi vs utf-8.

thanks
jeff

Post Reply