| 705 | |
| 706 | |
| 707 | string IntlUtil::escapeAttribute(Jrd::CharSet* cs, const string& s) |
| 708 | { |
| 709 | string ret; |
| 710 | const UCHAR* p = (const UCHAR*)s.begin(); |
| 711 | const UCHAR* end = (const UCHAR*)s.end(); |
| 712 | ULONG size = 0; |
| 713 | |
| 714 | while (readOneChar(cs, &p, end, &size)) |
| 715 | { |
| 716 | ULONG l; |
| 717 | UCHAR* uc = (UCHAR*)(&l); |
| 718 | |
| 719 | const ULONG uSize = cs->getConvToUnicode().convert(size, p, sizeof(l), uc); |
| 720 | |
| 721 | if (uSize == 2) |
| 722 | { |
| 723 | if (*(USHORT*) uc == '\\' || *(USHORT*) uc == '=' || *(USHORT*) uc == ';') |
| 724 | { |
| 725 | *(USHORT*) uc = '\\'; |
| 726 | UCHAR bytes[sizeof(ULONG)]; |
| 727 | |
| 728 | ULONG bytesSize = cs->getConvFromUnicode().convert( |
| 729 | sizeof(USHORT), uc, sizeof(bytes), bytes); |
| 730 | |
| 731 | ret.append(string((const char*)bytes, bytesSize)); |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | ret.append(string((const char*)p, size)); |
| 736 | } |
| 737 | |
| 738 | return ret; |
| 739 | } |
| 740 | |
| 741 | |
| 742 | string IntlUtil::unescapeAttribute(Jrd::CharSet* cs, const string& s) |
nothing calls this directly
no test coverage detected