M micro Well-Known Member Licensed User Longtime User Apr 30, 2016 #1 This is in reference to the thread https://www.b4x.com/android/forum/threads/2s-complement.66321/ I have a stringbuilder initialized with same value If i ceck (example) the value to thirteenth position B4X: Asc(buffer_st.ToString.SubString2(12,13)) the value is correct = 193 (0xc1) but after conversion into buffer (byte) B4X: Dim b() As Byte If buffer_st.Length = 0 Then Return b = conv.StringToBytes(buffer_st, "UTF8") the value to thirteenth position is -61 (0xFFFFFFC3) Is incorrect Encoding? Thanks
This is in reference to the thread https://www.b4x.com/android/forum/threads/2s-complement.66321/ I have a stringbuilder initialized with same value If i ceck (example) the value to thirteenth position B4X: Asc(buffer_st.ToString.SubString2(12,13)) the value is correct = 193 (0xc1) but after conversion into buffer (byte) B4X: Dim b() As Byte If buffer_st.Length = 0 Then Return b = conv.StringToBytes(buffer_st, "UTF8") the value to thirteenth position is -61 (0xFFFFFFC3) Is incorrect Encoding? Thanks
M micro Well-Known Member Licensed User Longtime User Apr 30, 2016 #2 Ok solved. I use int value and mask with Bit.And(255, xx) Upvote 0