import { useContext } from 'react'; import styles from '@/app/page.module.css' import { UtfdumpContext } from '@/context/utfdump'; import { EncodedCodepoint } from 'utfdump_wasm'; export function OutputTable(props: { currentString: string }) { const ctx = useContext(UtfdumpContext); let rows = []; if (ctx.utfdump) { for (const codepointStr of props.currentString) { const codepoint = codepointStr.codePointAt(0); if (codepoint !== undefined) { const charData = ctx.utfdump.codepoint_char_data(codepoint); if (charData !== undefined) { const encodedUtf8 = charData.encoded_utf8(); let encodedUtf8Str; if (encodedUtf8 !== undefined) { encodedUtf8Str = codepointToString(encodedUtf8); encodedUtf8.free(); } const encodedUtf16 = charData.encoded_utf16_le(); let encodedUtf16Str; if (encodedUtf16 !== undefined) { encodedUtf16Str = codepointToString(encodedUtf16); encodedUtf16.free(); } const combiningClassNum = charData.combining_class(); const combiningClassName = ctx.utfdump.combining_class_name(combiningClassNum); let charDisplayStr = codepointStr.replace(/\s+/, ' '); if (combiningClassNum !== 0) { charDisplayStr = '\u25cc' + charDisplayStr; } rows.push((
| Name | Code | UTF-8 | UTF-16LE | Category | Combining | Bidirectional | Numeric value |
|---|