LtiLibrary 1.4.3 score parsing/setting incorrect when server locale is not English.

Sep 19, 2014 at 8:09 AM
The LTI 1.1 specification states in 6.1.1. that the score in replaceResult should always be formatted using “en” formatting (

The current parser of the result score however uses the server locale. This works fine if the server locale is English but our server locale is Dutch... In Dutch locale the LTI library parses a score of “0.22” as 22, notices it is outside of the valid range and returns false to the tool provider.

Conversely the provider should always fill the language element of a score with “en” and format the score as a normal float (English locale).

I propose the following changes in the LTI library to fix this problem:
  • Add a constant to LtiLibrary.Common.LtiConstants :
public const string ScoreLanguage = "en";
  • Change the following lines of code in LtiLibrary.Outcomes.LtiOutcomesHelper.PostScore :
imsxBody.resultRecord.result.resultScore.language = CultureInfo.CurrentCulture.Name;
imsxBody.resultRecord.result.resultScore.textString = score.ToString();
imsxBody.resultRecord.result.resultScore.language = LtiLibrary.Common.LtiConstants.ScoreLanguage;
imsxBody.resultRecord.result.resultScore.textString = score.Value.ToString(CultureInfo.CreateSpecificCulture(LtiLibrary.Common.LtiConstants.ScoreLanguage));
  • Replace LtiLibrary.Outcomes.OutcomesApiControllerBase.GetResult for :
private static LisResult GetResult(ResultRecordType resultRecord)
            var result = new LisResult { SourcedId = resultRecord.sourcedGUID.sourcedId };    
            if (resultRecord.result != null)
                        var style = NumberStyles.Number | NumberStyles.AllowDecimalPoint;
                        var culture = CultureInfo.CreateSpecificCulture(LtiLibrary.Common.LtiConstants.ScoreLanguage);
                        double value;

                        if (double.TryParse(resultRecord.result.resultScore.textString, style, culture, out value))
                                   if (value >= 0 && value <= 1)
                                               result.Score = value;
            return result;
If you agree and would fix this in your library it would greatly easen our collaboration with other LTI providers and consumers.

Thanks in advance,

Martijn van der Corput
Senior .NET Developer PulseWeb
Noordhoff Health/PAT
Sep 20, 2014 at 5:52 PM
Thank you Martin. I made the changes and tested the code using a mix of en-US and nl-NL cultures in IISExpress. The changes are checked into CodePlex. Do you need a new build in NuGet? If not, I'll probably wait until I incorporate some changes proposed to the 1.2 Draft spec.