How to HTML encode or transliterate "tall" characters in Excel?

In Excel, how can I convert the contents of a cell that includes accented characters, curly quotes, etc. in HTML for the same characters, or a transliterated version of plaintext?

We have an XLS document that contains some "tall" characters. The data was pulled through a connection to the database, and it seems that Excel correctly processes individual cells (or rows) located in different code files.

When we export this data to CSV, some tall characters are not displayed correctly - it seems that Excel uses a single encoding for the document (of course) and the value of the character bit from the original code page (which may or may not correspond to other values ​​in the same document).

Since Excel displays the text correctly before exporting, I believe that we should be able to encode tall characters according to their HTML equivalents at this point, and then export to CSV, thereby ensuring that CSV is only ASCII.

(Alternatively, we could transliterate to simple ASCII, but this seems like a bad approach and probably not easier ...)

+3
source share
1 answer

There is a pgc01 function that seems to do the trick here: http://www.mrexcel.com/forum/showpost.php?p=2091183&postcount=7

I hope it will be useful for me to quote their code:

Function CodeUni(s As String, Optional bHex As Boolean = True)
    If bHex Then
        CodeUni = Right("0000" & Hex(AscW(Left(s, 1))), 4)
    Else
        CodeUni = AscW(Left(s, 1))
    End If
End Function

, Excel, : http://office.microsoft.com/en-us/excel-help/create-custom-functions-in-excel-2007-HA010218996.aspx

:

  • Alt + F11, VBA
  • >
  • !

HTML, :

="&#"&CodeUni(C1, TRUE)&";"

Ω„Ψ§ C1 E1 & ##FEFC;

+5

Source: https://habr.com/ru/post/1620303/


All Articles