Skip to content

Commit

Permalink
Merge pull request austintgriffith#220 from MaxStalker/bugfix/205-uni…
Browse files Browse the repository at this point in the history
…code-characters

Fix unicode character display in message
  • Loading branch information
TimDaub authored Jul 16, 2019
2 parents 26ee630 + c55f0bc commit d90f88e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/RequestFunds.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export default class RequestFunds extends React.Component {
}

// TODO: Understand why these `replaceAll`s are used here.
message = encodeURI(message).replaceAll("#","%23").replaceAll(";","%3B").replaceAll(":","%3A").replaceAll("/","%2F");
const encodedMessage = encodeURI(message).replaceAll("#","%23").replaceAll(";","%3B").replaceAll(":","%3A").replaceAll("/","%2F");
const currency = localStorage.getItem("currency");

const qrValue = `${url}/${address};${amount};${message};${currency}`;
const qrValue = `${url}/${address};${amount};${encodedMessage};${currency}`;

return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SendByScan.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SendByScan extends Component {
amount: parseFloat(dataSplit[1], 10)
}
if (dataSplit.length > 1) {
returnState.message = dataSplit[2]
returnState.message = decodeURI(dataSplit[2])
}
if (dataSplit.length > 2) {
returnState.currency = dataSplit[3]
Expand Down
6 changes: 5 additions & 1 deletion src/components/SendToAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class SendToAddress extends React.Component {
changeAlert
} = props;


let { scannerState: { amount, currency } } = props;
let currencyWarning = false;
let requestedAmount = 0;
Expand Down Expand Up @@ -103,7 +104,10 @@ export default class SendToAddress extends React.Component {

componentWillReceiveProps(newProps) {
if (this.props.scannerState !== newProps.scannerState) {
this.setState(Object.assign(this.state, newProps.scannerState))
this.setState({
...this.state,
...newProps.scannerState
})
}
}

Expand Down

0 comments on commit d90f88e

Please sign in to comment.