2

I am working on a project where different unicode characters has to be stored in table. math equations, physics formulae , subscript X2 , superscript X2.

greek characters like Link

I have made all tables collation and charset as utf16 , but problem I am facing is in data entry.

I have to manually enter data into tables because of some reasons, I am using sequel pro tool for data entry, many characters coming fine but subscript and superscript not coming properly, they will be treated as normal character. Also I am not sure whether sequel pro supports any kind of data or not, later I may face problem with some other characters. So is there any proper way to deal with this?

Also let me know whether utf16 is ok for collation and charset ?

Kindly let me know if any such tool which support all kind of data.

2 Answers 2

3

Do you have some way of entering utf16? I don't know of such, except internally in Java. The world is moving toward utf8, not utf16.

I recommend using utf8mb4 throughout. The collation may not matter; the default is utf8mb4_general_ci, but _bin or _unicode_ci are also possibilities.

A little history lesson on why I suggest utf8mb4 instead of utf8. More than a decade ago, MySQL added utf8, but coded it only to the extent of the 3-byte encodings. Recently, a number of 'new' Chinese characters have come out that need a 4-byte encoding. And there are other sets that need 4 bytes. MySQL realized that expanding its utf8 to 4 bytes would be far too incompatible, so it added utf8mb4 (think "MultiByte4"). A lot more info on utf8, etc: http://mysql.rjweb.org/doc.php/charcoll

2
  • thank you, but even if I use utf8mb4 how should i do data entry ? mainly subscript and superscript like elements. when it is subscript , superscript, it looks like normal digit like X2, not actually like subscript.
    – Sadanand
    Feb 15, 2015 at 0:53
  • Data entry depends on your client. There are many possibilities, a few are given in search.yahoo.com/yhs/…
    – Rick James
    Feb 15, 2015 at 6:04
0

To save math equation into database, a text format is more applicable. You can convert it to any format.

Refer to this question understanding a mathematica equation on mathematica.stackexchange.com, there are many math formula with many specified chars and in text format.

There are many ways to render a text formula.

  1. <script type="math/tex" id="MathJax-Element-19">n(r) = \frac{2\pi r^2}{\sqrt{3}}</script>, the math equation is with text format n(r) = \frac{2\pi r^2}{\sqrt{3}} in latex format.

  2. <math xmlns="http://www.w3.org/1998/Math/MathML"><mi>n</mi><mo stretchy="false">(</mo><mi>r</mi><mo stretchy="false">)</mo><mo>=</mo><mfrac><mrow><mn>2</mn><mi>&#x03C0;</mi><msup><mi>r</mi><mn>2</mn></msup></mrow><msqrt><mn>3</mn></msqrt></mfrac></math> is in mathml format.

  3. You also can use a render in your server or a client render to render the text formual to a image, like <img src="https://example.com/?e=n(r) = \frac{2\pi r^2}{\sqrt{3}}">

So you can choose a common formula format, when use it you can render it directly or convert it to other format, or image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.