Skip to content

Failing to parse Micro units #223

@JenTechSystems

Description

@JenTechSystems

Hi there,

I have a weird situation where I pass in what I think is the correct abbreviation for a Micro scale unit, but it fails.

Here is the unit test:

    [Test]
    public void GetAllElectricalPotentialAbbreviations()
    {
        UnitSystem usUnits = UnitSystem.GetCached(GetCulture("en-US"));

        var abbreviations = usUnits.GetAllAbbreviations(ElectricPotentialUnit.Microvolt);
        Assert.AreEqual("μV", abbreviations[0]);
        Assert.AreEqual("µV", abbreviations[0]);
        Assert.AreEqual("μV", "µV");
    }

Here is the result, which fails on the second assertion:

String lengths are both 2. Strings differ at index 0.
Expected: "µV"
But was: "μV"
-----------^

It seems like this WYSIWYG editor makes the differences in the encoding more visually obvious.

In fact, none of the editors i have used so far (include Visual Studio) have made a distinction between the two characters.

But how do i correctly deal with this difference programmatically?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions