Normaliza caracteres confundibles a texto seguro
Normalizar caracteres confundibles significa sustituir cada imitación por el carácter normal que imita, para que dos cadenas que se ven iguales también sean iguales al compararlas. Hazlo antes de comparar nombres de usuario, aplicar listas de bloqueo o eliminar identificadores duplicados.
Ejemplo resuelto
- Entrada
- Cоnfig file: аdmin2, Noёl, café
- Escrituras detectadas
- latino (Latn), cirílico (Cyrl)
- Caracteres marcados
- 7
| Posición | Carácter | Punto de código | Escritura | Reemplazo | Regla |
|---|---|---|---|---|---|
| 0 | C | U+FF23 | latino | C | Normalización NFKC |
| 1 | о | U+043E | cirílico | o | Mapa de confundibles |
| 7 | fi | U+FB01 | latino | fi | Normalización NFKC |
| 10 | : | U+FF1A | común | : | Mapa de confundibles |
| 12 | а | U+0430 | cirílico | a | Mapa de confundibles |
| 17 | 2 | U+FF12 | común | 2 | Mapa de confundibles |
| 22 | ё | U+0451 | cirílico | ë | Mapa de confundibles |
- Preservar Unicode legible
- Config file: admin2, Noël, café
- Reserva ASCII estricta
- Config file: admin2, Noel, café
Cómo funciona
- Primero se sustituyen las imitaciones conocidas según el mapa incluido. Los caracteres fuera del mapa se normalizan con NFKC, que convierte formas de ancho completo, ligaduras y otros caracteres de compatibilidad en sus equivalentes estándar.
- Preservar Unicode legible conserva una letra acentuada cuando el mapa la define, como la ё cirílica → ë. Reserva ASCII estricta usa en su lugar la letra ASCII simple (ё → e).
- Las letras que no están en el mapa ni cambian con NFKC se conservan, así que café mantiene su tilde en ambos modos. El texto normalizado es una clave de comparación, no un veredicto de seguridad: guarda también el original y revisa los caracteres marcados.
La conversión es el mejor esfuerzo: los confusables mapeados y el plegado NFKC son deterministas, pero algunos Unicode legítimos no serán marcados.
Tu texto
Pegar o escribir: los resultados se actualizan a medida que escribe (ligeramente rebotados para entradas largas).
30 caracteres analizados
7 sospechosos
Reserva ASCII estricta
Original (caracteres sospechosos marcados)
Los caracteres sospechosos en la vista original están subrayados y etiquetados como "sospechosos". además de resaltar el color.
suspicious character Csuspicious character оnfig suspicious character filesuspicious character : suspicious character аdminsuspicious character 2, Nosuspicious character ёl, café
Salida limpia
Análisis de caracteres
| Índice (basado en 0) | Original | Reemplazo | Punto de código | Razón |
|---|---|---|---|---|
| 0 | C | C | U+FF23 | NFKC normalization changed this character (compatibility or width folding). |
| 1 | о | o | U+043E | Non-ASCII confusable mapped to a safer Latin ASCII equivalent. |
| 2 | n | n | U+006E | Not flagged as a confusable or compatibility character. |
| 3 | f | f | U+0066 | Not flagged as a confusable or compatibility character. |
| 4 | i | i | U+0069 | Not flagged as a confusable or compatibility character. |
| 5 | g | g | U+0067 | Not flagged as a confusable or compatibility character. |
| 6 | U+0020 | Not flagged as a confusable or compatibility character. | ||
| 7 | fi | fi | U+FB01 | NFKC normalization changed this character (compatibility or width folding). |
| 8 | l | l | U+006C | Not flagged as a confusable or compatibility character. |
| 9 | e | e | U+0065 | Not flagged as a confusable or compatibility character. |
| 10 | : | : | U+FF1A | Non-ASCII confusable mapped to a safer Latin ASCII equivalent. |
| 11 | U+0020 | Not flagged as a confusable or compatibility character. | ||
| 12 | а | a | U+0430 | Non-ASCII confusable mapped to a safer Latin ASCII equivalent. |
| 13 | d | d | U+0064 | Not flagged as a confusable or compatibility character. |
| 14 | m | m | U+006D | Not flagged as a confusable or compatibility character. |
| 15 | i | i | U+0069 | Not flagged as a confusable or compatibility character. |
| 16 | n | n | U+006E | Not flagged as a confusable or compatibility character. |
| 17 | 2 | 2 | U+FF12 | Non-ASCII confusable mapped to a safer Latin ASCII equivalent. |
| 18 | , | , | U+002C | Not flagged as a confusable or compatibility character. |
| 19 | U+0020 | Not flagged as a confusable or compatibility character. | ||
| 20 | N | N | U+004E | Not flagged as a confusable or compatibility character. |
| 21 | o | o | U+006F | Not flagged as a confusable or compatibility character. |
| 22 | ё | e | U+0451 | Non-ASCII confusable mapped to a safer Latin ASCII equivalent. |
| 23 | l | l | U+006C | Not flagged as a confusable or compatibility character. |
| 24 | , | , | U+002C | Not flagged as a confusable or compatibility character. |
| 25 | U+0020 | Not flagged as a confusable or compatibility character. | ||
| 26 | c | c | U+0063 | Not flagged as a confusable or compatibility character. |
| 27 | a | a | U+0061 | Not flagged as a confusable or compatibility character. |
| 28 | f | f | U+0066 | Not flagged as a confusable or compatibility character. |
| 29 | é | é | U+00E9 | Not flagged as a confusable or compatibility character. |