Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit In Excel: Fix metadata generation bug when caption name uses en dash instead of em dash #2032

Merged
merged 7 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ codeunit 1482 "Edit in Excel Impl."
CurrentPosition := 1;

while CurrentPosition <= StrLen(ConvertedName) do begin
if ConvertedName[CurrentPosition] in ['''', '+'] then begin
// Notice in the following line that – (en dash) is not a normal dash (em dash).
// We need to handle this here because at least the norwegian translation uses en dash.
if ConvertedName[CurrentPosition] in ['''', '+', '–'] then begin
DenLilleMand marked this conversation as resolved.
Show resolved Hide resolved
ByteValue := Convert.ToByte(ConvertedName[CurrentPosition]);
StartStr := CopyStr(ConvertedName, 1, CurrentPosition - 1);
EndStr := CopyStr(ConvertedName, CurrentPosition + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,19 @@ codeunit 132525 "Edit in Excel Test"
PlusFieldName: Text;
RegularFieldName: Text;
FieldNameStartingWDigit: Text;
EnDashFieldName: Text;
begin
Init();
FieldNameStartingWDigit := EditinExcelTestLibrary.ExternalizeODataObjectName('3field');
RegularFieldName := EditinExcelTestLibrary.ExternalizeODataObjectName('field');
ApostropheFieldName := EditinExcelTestLibrary.ExternalizeODataObjectName('new vendor''s name');
PlusFieldName := EditinExcelTestLibrary.ExternalizeODataObjectName('c+c field');
EnDashFieldName := EditinExcelTestLibrary.ExternalizeODataObjectName('lager – reklassfication field');
LibraryAssert.AreEqual('field', RegularFieldName, 'Conversion alters name that does not begin with a string');
LibraryAssert.AreEqual('_x0033_field', FieldNameStartingWDigit, 'Did not convert the name with number correctly');
LibraryAssert.AreEqual('new_vendor_x0027_s_name', ApostropheFieldName, 'Did not convert the name with an apostrophe correctly');
LibraryAssert.AreEqual('c_x002b_c_field', PlusFieldName, 'Did not convert the name with a plus correctly');
LibraryAssert.AreEqual('lager__x2013__reklassfication_field', EnDashFieldName, 'Did not convert the name with an `en dash` correctly');
end;

[Test]
Expand Down
Loading