What is “Character Encoding” used for in Rational Team Concert? - character-encoding

I’m a bit confused about the “Character Encoding” in Rational Team Concert, while having trouble with UTF-8 encoded files that are now stored in RTC. (I never had any trouble with these files before.)
The “Character Encoding” shows up in the Eclipse client (at least) here:
File Compare.
Jazz SCM Properties.
The “Character Encoding” is not displayed in the Visual Studio RTC client, at least I could not find it. (Of course, VS has its own ways to display and change encoding of files, but these are independent of RTC.)
I saw several files that are version controlled with MIME Type text/plain which have different “Character Encoding”s for nearly every revision, sometimes changing from UTF-8 to Cp1252 back and forth. Usually, only a few lines in a large file are changed.
It seems to me that automatic merge with the Visual Studio client regularly, but not always, gets confused with encoding and/or byte order marks and changes non 7-bit-ASCII characters. I cannot reproduce this.
I learned several things from a good answer:
Encoding isn’t stored on the server, it is client-only.
scm set property file.encoding sets a user property (and this even can be set to random value such as foo). However:
As far as I can see, file.encoding is completely ignored by Visual Studio, although this doc says:
To change the encoding for files that are checked in from the CLI or Rational Team Concert Client for Microsoft Visual Studio IDE, run scm set property [...] Example: scm set property file.encoding UTF-8 path/to/file.
tl;dr: My question is: Is this “Character Encoding” and/or “file.encoding” of any relevance, and if yes, what is it used for?

Following the FAQ, it is used by an RTC Client (Eclipse or VS) at the checkin phase.
If the encoding specified there differs from the one used in the file you want to check-in, there will be an error:
Basically, there is a text file that Jazz attempted to read when checking in the project contents that it could not because the content does not adhere to the encoding rules. The error message should provide you with the name of file that caused the problem.
Within Eclipse, you have a default encoding for text files.
To see what it is, from the toolbar select Windows > Preferences... > General > Workspace.
If this is not the encoding for most of your text files, you should change it here.
When working within a team you should decide upon a common encoding that you and your team will use. That encoding should also be available on the server (for annotate to work well). You will need to communicate with the rest of your team what the encoding is.

Related

Jenkins Change Assembly Info Plugin not working on Linux Host and Windows Slave

I have a configuration using a Linux Jenkins master and a Windows 10 slave. I'm using it to do an msbuild operation on the slave and generate an install executable as an artifact. I have this working on a Jenkins Windows 10 master system (same one I'm using as a slave), and this all works fine. However, when I run the same job remotely I get the dreaded "CS1031" error:
Properties\AssemblyInfo.cs(1,1): error CS1031: Type expected [C:\slave2Workspace\workspace\SDB Projects\CCMonitor\CCMonitor\CCMonitor\CCMonitor.csproj]
This is pointing at the first character in the file. If I omit the job step with the Change Assembly Info plugin, everything works fine and I get the output correct. What I found was that the AssemblyInfo.cs file was missing the characters 0xEB 0xBB at the front of the file -- these somehow got dropped in the translation. Sounds like a character set issue, but it is only an issue with this plugin step.
Is there something that needs to be configured differently?
thanks!!
So I had this same issue today and found the solution. Not sure if you ever figured this one out, so I wanted to drop the solution just in case.
Turned out to be an encoding issue. The assembly file is encoded UTF-8 with signature. As a workaround to avoid the characters being added to the beginning of the file, change the encoding to UTF-8 without signature.
I did this by opening the files in notepad++ and then selecting Encoding -> Encode in UTF-8
If you are working with Visual Studio (2017 in my case)
Open the file with the problem
Select File | Save As
On the Save button there is drop down with option stating Save with Encoding
In the list with encodings select UTF-8 without signature
VS may tell you that there is already such file, you select to overwrite it.
Commit>Push with your source control (git in my case), and voila - that's it.

Visual Studio Team Services build with special character in file names

EDIT
Like suggested in the answers, i submitted this behavior to visual studio, and as a solution, i removed those special characters in the files name.
Visual Studio Team Services (was TFS Online) generated a build of the new version of my the solution, no problems in that. But i noticed that some files that i uploaded that have some special characters (ã,ç,õ), were generated with other characters, like "ç" changed to +º+.
We can't upload files with those characters? Or is some configuration that i am missing in the build configurations or elsewhere? Or some files with wrong encoding ? I uploaded .mp4 files and those special characters were changed as well.
Searched for this particular problem and only found problems with file name too long.
Looks like a bug. You probably need to submit it on the UserVoice site:
https://visualstudio.uservoice.com/forums/121579-visual-studio-2015

Compare a long single-line XML between versions in TFS

I've got a WSDL service definition checked into our repository. I've noticed that it has changed between versions, and I would like to see what exactly has been changed.
Unfortunately, said WSDL file is a singe-line XML file, albeit a pretty long one. TFS compare shows the entire line as changed, which isn't really helpful.
How can I compare changes between versions for a long single-line XML file in TFS?
PS. Obviously I could copy both versions, format them, and use an external comparing tool. What I'd like to know if there's a way to do this comparison using tools provided by VS / TFS.
You don't need an external tool as Visual Studio can compare any file, even local files located on the local file system:
But you still need to do some formatting (a basic search ">" and replace ">\n" would do though) in order to locate the lines which have changed.
TFS will only do line for line comparison, so single string to single string. You are going to have to use an external tool if you want more information about what was changed.
I would suggest prettifying/formatting the XML and then doing the comparison on both versions, it should be fairly simple to spot then.
I will be upfront I represent the company at hand, but I'm fairly certain this can help you.
This use case is exactly what DeltaXML is for so please feel free to take a look at our free evaluation or free online sandbox to provide you with a line by line comparison or your XML.
http://www.deltaxml.com/products/core/

Subversion Exclusive Checkout and Subversion Plugin for Delphi

Is there currently a feature that allows a exclusive checkout in SVN?
Is there a good plugin for Delphi that allows the access via IDE?
SVN has a concept of "locking" which roughly corresponds to the exclusive checkout. For example, in TortoiseSVN this is exposed via Get lock and Release lock menu entries.
JCL contains a SVN version control expert which works quite fine. Besides other things, tt gives you access to the locking functionality from the IDE.
TortoiseSVN can be added into the Delphi tools menu. I've not tried this myself, since I'm happy using it as an Explorer extension.
Regarding the exclusive checkout, I'm guessing you mean so only one person can edit it at a time? That's not really the idea behind Subversion, the idea is you have working copies and then check in your changes. It'll then try to merge your changes in (this usually works most of the time). If there are conflicts you'll need to resolve them manually.
I believe one of the reasons why people sometimes enquire about locking items in a Subversion repository is because they have their Delphi DFMs saved in a binary format, which makes committing/merging problematic.
An alternative to changing DFMs etc to text is use Scooter Software's Beyond Compare.
Beyond Compare is written in Delphi, and natively knows how to read binary DFMs. This means that it then becomes less of an issue (or even no issue) whether your DFMs are stored in Subversion in binary or text. Beyond Compare V3 also does 3-way merging which makes it really easy to merge multiple commits etc. Even ignoring the ability to diff binary DFMs, it's still a much better diff viewer than TortoiseSVN's built-in tools. I can highly recommend it, and it's very inexpensive.
Currently the only things that I lock in our repository are COM type libraries (*.tlb and their associated *_TLB.pas files).
Regarding exclusive checkouts. It can be done, but it's a pain and generally not worth the time. If you do have dfms saved as binary, convert them to text.
Regarding delphi addins, I have a post at Delphi addins for subversion.
I use the jedi jcl, and TortoiseSvn.
There are also Delphi svn and Delphi addin in for Tortoise svn that I know of.
Maybe I'm naive, but why would anyone want to go to the enormous trouble of merging their changes? Merging might be a simple matter if programmers were editing text files whose contents are easily understood, and which therefore could be merged by virtue of the programmers knowing the meanings of the changes. However if you're using SVN with MS Visual Studio, where changes to one file frequently case changes to other files you didn't know about, and where the encoding of information in such files may be completely unknown to the programmers (who would therefore have no concept of how to interpret much less merge such files) and may even be binary, why would you go to the enormous trouble and risk of having multiple people simultaneously editing things?
The locking paradigm is simple. Only one person edits at a time. Merging is never required. Programmers don't need to know the encodings of (possibly binary) files that they don't even realize that they're modifying. Nobody can stomp on anyone else's changes. Locking (i.e. locking by default) sounds much preferable to me.
What do you mean by "exclusive checkout"? Do you mean that after you check out, nobody else can check out?
That's called a lock and subversion can do this (see Locking), though it's not recommended in general as the purpose of version control is to allow multiple people to simultaneously work on the versioned item.
For first part, I was using Visual Source Safe which is support locking (you have to check out before use), SVN has locking command, but it's against it's concept, you need few time to get used with it, and you will never use the locking command again.
For second part of your question, The TortoiseSVN can be used as external tool, or you can get it working with File Browser bundled with Delphi 2007 and above, and you can use IBrowser which work with older versions.
and Subversion add-ins for Delphi summarize the available SVN plug-ins for Delphi IDE, beside SourceConneXion which is commercial product.

Elastic tabstop editors and plugins

What Windows code editors allow the use of elastic tabstops, either natively or through a plugin?
I know about a gedit plugin, but it only works on Linux.
Code Browser may be the first for windows. I would love to see this feature as a plugin for other editors as well.
I did quite a bit of googling trying to find this answer. There are plenty of people asking for it:
http://developers.slashdot.org/comments.pl?sid=414610&cid=21996944
http://www.arguingwithmyself.com/archives/75-the-biggest-feature-your-editor-is-missing
http://intype.info/blog/screencast-parser-in-editor/#comment-221
http://codewords.wordpress.com/2006/10/16/eclipses-achilles-heel/
just to name a few...
so I don't think one exists yet, sorry :(
Code Browser supports elastic tabstops, but it appears to be the only thing for Windows that currently supports it. Unfortunately, it has an unusual UI which may render it unsuitable for multi-person projects, and may even make it difficult for you to use even if no other editors are involved.
According to the elastic tabtops website, he's working on plugins for eclipse and Visual Studio 2010 (though the Eclipse plugin is stalled pending a bugfix, and jedit should support elastic tabstops in an upcoming version.
Finally, though this probably isn't an option, you could try running an x server (such as Cygwin/X or Xming on your Windows computer and ssh into a Linux client (either a virtual machine or another computer) to run Gedit. This approach has many problems though: you need to keep your files on a separate computer (perhaps using Dropbox to keep them in sync), X over SSH is notoriously slow, and you need either another computer or a virtual machine.
XMLQuire is an XML editor developed for windows to showcase virtual formatting. This concept goes a step further than elastic tabstops, indentation is simply a function of the position of the preceding line-feed character and the nesting level and context assessed by the parser:
It's the XML parser that determines the nesting level and therefore the required indentation, there's no reformat key or tab key to press, the XML formatting just reflows as you edit, drag and drop etc.
This means that XML is always properly indented, but without leading tabs or spaces. The concept should also work for more conventional code (except for languages like F# that exploit whitespace), but this has not yet been tried out.
Note that, unlike elastic tabstops, virtual formatting only works from the left-margin and only uses the parser context. The parser context is more than just about nesting level though, factors such as mixed content, node-type, length of parent element name and attribute name all come into the equation. This allows alignment of attributes and attribute values that occur on new lines also (as shown).
Word-wrapped text naturally just fits to the indentation scheme. If further text formatting is required then space characters are added by the user in the conventional way.
As with elastic tabstops there's a potential issue when virtually formatted text is opened in a more conventional editor. However, because no characters have been added for XML formatting (it was all virtual), conventional editors can simply apply conventional formatting according to the settings for that editor, uses tabs or spaces.
Here's a elastic tabstop plugin for Visual Studio 2010 by ferveo (Ramunas Geciauskas):
http://visualstudiogallery.msdn.microsoft.com/ccff2b55-201f-4263-aea5-3e66024d6c0e
Another option is jedit which has already added support for elastic tabstops. It is available on Windows, Linux, OS X, and Unix.
The problem is that only a few toolkits/platforms have text widgets that offer the ability to set non-uniform tabstops on different lines. To my knowledge, those toolkits/platforms are Java Swing (used by the demo on the elastic tabstops page), GTK (used by Gedit and the Gedit plugin), and apparently the new version of Visual Studio (VS 2010).
Expect to (eventually) see more developments on all of those platforms.
Textadept has an elastic tabstop plugin.
Atom also has a plugin.

Resources