# Packing and unpacking binary data

**URL:** https://discourse.julialang.org/t/packing-and-unpacking-binary-data/1638
**Category:** New to Julia
**Tags:** question, strpack, binaryio
**Created:** [January 22, 2017, 10:46am UTC](https://discourse.julialang.org/t/packing-and-unpacking-binary-data/1638 "2017-01-22T10:46:19Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)
#### Post date: [January 22, 2017, 2:23pm UTC](https://discourse.julialang.org/t/packing-and-unpacking-binary-data/1638/7 "2017-01-22T14:23:58Z")

</div>

Converting the `UInt8` array to a string is done by `String()`. I tried `string()` before but that was not the right one.

So now I am playing around with `reinterpret` but I need a way to deal with different endianness. So I guess I have to reverse the array if needed 😕

```julia
julia> a[9:12]
4-element Array{UInt8,1}:
 0x00
 0x00
 0x00
 0x04

julia> reinterpret(Int32, a[9:12])
1-element Array{Int32,1}:
 67108864

julia> reinterpret(Int32, reverse(a[9:12]))
1-element Array{Int32,1}:
 4

```

---

_[View the full topic](https://discourse.julialang.org/t/packing-and-unpacking-binary-data/1638)._
