anchor.diff:      end;
   t2s(T) -> io_lib:format("~p", [T]).
   
  +
  +escape_io(Str) when is_list(Str) ->
  +    re:replace(Str, "(\022)", "\\\022", [global, {return, list}]);   
  +escape_io(Bin) when is_binary(Bin) ->
  +    re:replace(Bin, "(\022)", "\\\022", [global, {return, binary}]). 
  +
   string_to_io(Val) when is_list(Val) ->
  -    IsString = io_lib:printable_unicode_list(Val),
  -    if 
  -        IsString ->     list_to_binary(io_lib:format("\"~ts\"",[Val]));   %% "~ts" ToDo: handle escaping and quoting etc.
  -        true ->         list_to_binary(lists:flatten(io_lib:format("\"~tp\"",[Val])))
  +    case io_lib:printable_unicode_list(Val) of
  +        true ->    %% list_to_binary(io_lib:format("\"~ts\"",[Val]));
  +            unicode:characters_to_binary([$" | escape_io(Val) ++ [$"]]);
  +        false ->
  +            list_to_binary(lists:flatten(io_lib:format("\"~tp\"",[Val])))
       end;                                    
   string_to_io(Val) ->
  -    list_to_binary(lists:flatten(io_lib:format("\"~tp\"",[Val]))).
  +    list_to_binary(lists:flatten(io_lib:format("~tp",[Val]))).      %% "\"~tp\""
   
   integer_to_io(Val) ->
       list_to_binary(integer_to_list(Val)).
  
positive.code: 
      ?assertEqual(OldString, io_to_db(Item,OldString,binstr,Len,Prec,Def,true,<<"NewVal">>)),
          ?Info("io_to_db success 4a~n", []),
          ?assertEqual(<<"NöVal">>, io_to_db(Item,OldString,binstr,6,undefined,Def,RW,<<"NöVal">>)),
          ?assertEqual(default, io_to_db(Item,OldString,binstr,Len,Prec,Def,RW,?emptyStr)),
          ?assertEqual(<<>>, io_to_db(Item,OldString,binstr,Len,Prec,<<>>,RW,?emptyStr)),
          ?assertEqual(<<"{}">>, io_to_db(Item,OldString,binstr,Len,Prec,Def,RW,<<"{}">>)),
  
negative.code: %% -*- coding: utf-8 -*-
  -module(imem_datatype).
  -compile(inline).
  -compile({inline_size,1000}).
  