/* Octets with the highest bit set will be converted to the Unicode REPLACEMENT CHARACTER.  */
guint8* get_ascii_string(wmem_allocator_t *scope, const guint8 *ptr, gint length)
/* Octets with the highest bit set will be converted to the Unicode REPLACEMENT CHARACTER.  */
guint8* get_ascii_string(wmem_allocator_t *scope, const guint8 *ptr, gint length)
{
    wmem_strbuf_t *str;
    str = wmem_strbuf_sized_new(scope, length+1, 0);
    while (length > 0) {
        guint8 ch = *ptr;
        if (ch < 0x80)
            wmem_strbuf_append_c(str, ch);
        else
            wmem_strbuf_append_unichar(str, UNREPL);
        ptr++;
        length--;
    }
    return (guint8 *) wmem_strbuf_finalize(str);
}