0

I'm modifying my Delphi projects to use a version-information resource file instead of storing version information within the project file.

My VersionInfo.rc file:

1 VERSIONINFO
FILEVERSION 1,10,0,999
PRODUCTVERSION 1,10,0,0
FILEOS 0x4
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
    BLOCK "040904E4"
    {
        VALUE "CompanyName", "Company Inc.\0"
        VALUE "FileDescription", "Product\231\0"
        VALUE "FileVersion", "1.10.0.999\0"
        VALUE "InternalName", "Product\231\0"
        VALUE "LegalCopyright", "\251 2016 Company Inc.\0"
        VALUE "LegalTrademarks", "Company\231 Product\231\0"
        VALUE "ProductName", "Product\231\0"
        VALUE "ProductVersion", "1.10\0"
    }
}

BLOCK "VarFileInfo"
{
        VALUE "Translation", 0x409, 1252
}
}

The registered trademark (\256) and copyright (\251) symbols display properly in the file's properties dialog, but the trademark (\231) does not show at all. It appears that no character is shown in its place unless it's unprintable. I've also tried using the symbol directly in the resource instead of the octal code and I see the same behavior.

When the trademark symbol is stored as part of my project options it displays properly.

How do I insert the trademark symbol in my resource?

EDIT: Additional info

I'm using RAD Studio 10.1 Berlin and I was following the answer from this StackOverflow post to create my resource file, configure my project options, and to include the resource in the project source using {$R 'VersionInfo.res' 'VersionInfo.rc'}. I had tried encoding my .rc file using ANSI, UTF-8, UTF-16 BE and LE and trade mark either fails to show properly in file properties dialog or there is a BRCC32 error when building.

I had found this web page suggesting to use octal code for copyright. I had tried the octal codes for trade mark in my VersionInfo.rc file and again saw the same.

I had also tried compiling the resource using rc.exe and adding it to my project using "Add to Project..." menu item from Delphi's Project menu. I received "Unsupported 16bit resource..." errors when building.

Community
  • 1
  • 1
Michael S.
  • 1,771
  • 15
  • 20
  • Why are you doing this in ANSI? – David Heffernan Sep 23 '16 at 13:34
  • I have no idea! I literally just stumbled upon this yesterday as a better approach for injecting version information and I copied a sample file from a blog/article and found another site that said octal codes must be used for symbols. – Michael S. Sep 23 '16 at 13:41
  • http://stackoverflow.com/questions/12692803/are-resource-files-compiled-as-unicode-or-ansi-code-page – David Heffernan Sep 23 '16 at 13:49
  • Use a modern editor, save your .RC file as a Unicode (not ansi file). Also be careful which RC you are using. There are some old Delphi versions that ship with ancient Resource Compilers that may not support the same things that a modern Windows Resource Compiler supports. You didn't state your Delphi version, or if you're using RC or BRCC – Warren P Sep 23 '16 at 15:51
  • I'm using RAD Studio 10.1. I omitted what I thought was superfluous info from my original post about my failed ventures, but the down votes suggests I should have included it. I use Notepad++ and had tried saving the .rc file using ANSI/UTF-8/UTF-16 LE & BE. Including the resource using {$R n.RES n.rc} fails for all, but ANSI encoding thus the octal codes I tried. That uses brcc32. Using rc to create the .res causes all sorts of problems in Delphi about Unsupported 16bit resource. I'll finish my new testing before editing my question to outline my prior research and today's research. – Michael S. Sep 23 '16 at 16:30
  • If one or both of you want to suggest an answer I'll bump it up. The Unicode encoding could be mentioned in the other SO link I included to improve that answer, but ultimately my problem was that having a tab opened for the .RES file was causing build errors. Delphi will automatically open a tab for a file when using the Add to Project feature. I was not closing that tab. I had tried rc.exe yesterday and just using Add to Project out of laziness and it wouldn't build and relying on BCRR32 does not work in 10.1 Berlin for me regardless of the .rc file encoding. – Michael S. Sep 23 '16 at 18:48
  • I had thought there was some "secret" way I needed to encode trade mark since the other symbols I use were OK, only trade mark was problematic. – Michael S. Sep 23 '16 at 18:49
  • Using a proper resource compiler is always the first move. Embarcadero's is useless. – David Heffernan Sep 23 '16 at 19:14
  • Editing to add the solution is inappropriate here. If you've found a solution to the problem and want to share it, do so by writing an answer in the space provided below for that purpose. It is perfectly acceptable to [answer your own question here](http://stackoverflow.com/help/self-answer). I was tempted to roll back your entire edit, but you added additional details as well, so I opted to leave it for now and give you the opportunity to edit again to remove the solution portion and post an answer without throwing away those additional details. Please do so. – Ken White Sep 23 '16 at 20:45
  • Thanks for not deleting, Ken. That took me far too long to research today! Fixed. – Michael S. Sep 24 '16 at 00:15

1 Answers1

1

After David and Warren's comments I revisited my tests and found that the following works.

  1. Create .rc file containing text and symbols as needed. Both ANSI encoding and UCS-2 Little Endian worked well for this file given my file's contents.
  2. Compile the resource with a proper resource compiler like rc.exe
  3. Add the compiled resource to the project DPR manually or use Delphi's Add to Project feature. If using Add to Project be sure to close the automatically opened tab for the .RES file else "Unsupported 16bit resource..." errors result when building.
Michael S.
  • 1,771
  • 15
  • 20