Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

[SoM] Unicode mapping should be more flexible #138

Open
stephen-hawley opened this issue May 23, 2018 · 3 comments
Open

[SoM] Unicode mapping should be more flexible #138

stephen-hawley opened this issue May 23, 2018 · 3 comments
Assignees
Milestone

Comments

@stephen-hawley
Copy link
Contributor

SoM has built-in unicode mapping in UnicodeMapper.cs.

This needs some refactoring.
First, the static definition should be moved to an external file
Second, the mapping is current char -> String. The .NET char holds one UTF16 code point, ideally the mapping should allow UTF32 code points rather than UTF16 since swift allows > 16 bit code points. See the definition of a swift identifier here.
Finally, there should be a command line option to allow user-selectable mappings from an input file.
Suggest -unicode-mapping:file which should be allowed multiple times and each subsequent one can override previous definitions.

File format? Why not XML.

<?xml version="1.0" encoding="utf-8"?>
    <unicodemapping version="1.0">
        <map from="" to="" />
    </unicodemapping>
@chamons chamons self-assigned this May 23, 2018
@chamons
Copy link
Contributor

chamons commented May 24, 2018

So I did some looking, and I think we should punt on this for awhile.

Here's what I found:

  • We call this code in one place
  • However, that is static and called by many (20+) places
  • Thus, we have two and 1/2 options, either:
    • Hold onto static configuration data which is setup sometime after startup (yuck)
    • Update every called to have to pass the xml file through (double yuck)
    • Make it non-static and make all callers have an instance to call on, store data there
  • There was some discussion if we could just bypass this by harvesting data somewhere to get a "full list of emoji with names".
  • Turns out this isn't too bad: I wrote up a prototype].
  • It is not complete, to begin with we don't sanitize the names into valid C# method names (remove spaces, &, etc).

So the real question is do we:

  • Punt on this for now
  • Generate a full list and make it not user editable
  • Refactor the code to somehow get the xml config passed through.

Thoughts?

https://github.com/chamons/emojidump

@chamons
Copy link
Contributor

chamons commented May 24, 2018

Ok, correction we already have static data in the hard coded list, so adding the "load this xml and addrange it in", isn't too far from what we have already.

@chamons
Copy link
Contributor

chamons commented Jun 1, 2018

Splitting the rest of this issue into https://github.com/xamarin/maccore/issues/833

@stephen-hawley stephen-hawley transferred this issue from another repository Oct 29, 2019
@chamons chamons added this to the Future milestone Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants