Index: src/string/charset/binary.c =================================================================== --- src/string/charset/binary.c (revision 47303) +++ src/string/charset/binary.c (working copy) @@ -147,8 +147,9 @@ =item C -Converts the STRING C to STRING C in binary mode. Throws -an exception if a suitable conversion function is not found. +Converts the STRING C to STRING C in binary mode. +Just a byte image of the string content regardless its charset +and encoding. The user is supposed to know what is doing. =cut @@ -159,14 +160,16 @@ to_charset(PARROT_INTERP, ARGIN(const STRING *src)) { ASSERT_ARGS(to_charset) - charset_converter_t conversion_func = - Parrot_find_charset_converter(interp, src->charset, Parrot_binary_charset_ptr); - if (conversion_func) - return conversion_func(interp, src); - - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, - "to_charset for binary not implemented"); + const UINTVAL bytel = src->bufused; + STRING *r = Parrot_gc_new_string_header(interp, 0); + Parrot_gc_allocate_string_storage(interp, r, bytel); + r->strlen = bytel; + r->bufused = bytel; + r->charset = Parrot_binary_charset_ptr; + r->encoding = Parrot_fixed_8_encoding_ptr; + mem_sys_memcopy(r->strstart, src->strstart, bytel); + return r; } /*