Friday, September 6, 2013

Cure for broken TEXTINCLUDE section of VC++ resource files


Today I've configured VC++ project to allow editing Chinese resources from Visual Studio, which ended up in SVN Commit error “Inconsistent line ending style”.

Pic 1.  After each resource modification Visual Studio was writing incorrect end of line sequence to “Read-Only Symbol Directives” area


Details
If we configure bsw\resource.zh-CN.rc according to TN035, we would be able to edit resources “visually”:

Pic.2 xxx.zh-CN.rc uses “resource.h” among “Read-Only Symbol Directives” to have the same IDs with xxx.rc:
 

 


But when committing changes, we’ll get an SVN error “Inconsistent line ending style” (see pic. 2)
We would have to recover CR-LF sequence manually every time we modify Chinese resources, for example using Notepad++
 

Solution
After using "Resource Includes" dialog and saving .rc filers we have to modify "Resource Includes" dialog output manually. 
  • Search for "2 TEXTINCLUDE" section in .rc file
  • Add "\r\n" at the end of any stored string
  • Add "\0" at the very end of any 2 TEXTINCLUDE section
  • Do the same with "3 TEXTINCLUDE" section



PS We're not the first who faced this issue: Line endings in TEXTINCLUDE

No comments:

Post a Comment